Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22144

How to build libstdc++-v3 with rtti enabled?

$
0
0

I'm making some small modifications to GCC. In particular, I'm changing the implementation to an allocator in libstdc++-v3/include/ext. To perform the change however, I need to use <typeinfo>, in particular typeid(T).name().

Upon compiling with the following configure flags:

../gcc-10.1.0/configure -v \--build=x86_64-linux-gnu --host=x86_64-linux-gnu \--target=x86_64-linux-gnu --prefix=/usr/local/gcc-10.1.0 \--enable-checking=release --enable-languages=c,c++,fortran \--disable-multilib --program-suffix=-10.1 \--enable-libstdcxx-allocator=auto

I get the error:

/home/ray/home/build/prev-x86_64-linux-gnu/libstdc++-v3/include/ext/profile_allocator.h:107:68: error: cannot use ‘typeid’ with ‘-fno-rtti’  107 |           printf("allocated %d of type %s\n", __n, typeid(_Tp).name());

... and so I took to find occurrences of -fno-rtti in the configure script, which is like >10k loc. The occurrences are around here:

  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions">&5$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... ">&6; }if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :  $as_echo_n "(cached) ">&6else  lt_cv_prog_compiler_rtti_exceptions=no   ac_outfile=conftest.$ac_objext...

You can find the file here.

I removed them, cleaned up the directory, and re-make'd and still ran into the same problem. Is there some reason we can't build libstdc++ with rtti enabled?

Disclaimer: profile_allocator.h is not in gcc. I added it myself and was able to add basic features in it without trouble.


Viewing all articles
Browse latest Browse all 22144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>