This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libtool insistence upon -fno-rtti -fno-exceptions in libsupc++?


Hi there,

I'm attempting to build libstdc++ for the Atmel AVR family, which is an 8-bit microcontroller.
This is in a freestanding environment that's got somewhat limited memory space
(the biggest part has 4K of RAM, and the smallest supported by gcc has 64 bytes of RAM).


As a result, I'm compiling this as a freestanding library,
and I suspect that most people will be using "-fno-exceptions -fno- rtti" in their compilation.


However, (assuming there's no penalty for doing so when you use those flags),
I have no problems making the exception handling and RTTI available in the library.
Similarly, I wouldn't care if I had to compile the library without them, at least for right now.


I'm working from the HEAD of the gcc (4.2.0beta?) svn sources.

avr-gcc and avr-libc work fine, and I have no problems compiling them.

However, when the compilation gets to libsupc++,
I have problems with libtool insisting upon using "-fno-rtti -fno- exceptions" to compile code that uses "typeid", which then fails the compilation.


I did not ask for "-fno-rtti -fno-exceptions".

I did originally try using "-fno-exceptions" in the --enable-cxx- flags config argument, but had the same problem,
so I removed it and re-configured and tried building again. No improvement.


I'm configuring using:
====
prefix=/opt/local
crossgccTarget=avr
version=4.2-20060429
${srcdir}/configure \
--prefix=${prefix} \
--infodir="${prefix}/share/info" \
--mandir="${prefix}/share/man" \
--target=${crossgccTarget} \
--program-prefix=${crossgccTarget}- \
--with-included-gettext \
--with-gxx-include-dir=${prefix}/${crossgccTarget}/include/c+ +/${version}/ \
--disable-libssp \
--disable-nls \
--disable-symvers \
--disable-hosted-libstdcxx \
--disable-threads \
--enable-cstdio=stdio \
--enable-libstdcxx-allocator=malloc \
--disable-long-long --disable-wchar_t \
--enable-sjlj-exceptions \
--enable-languages=c++ \
--with-sysroot=${prefix}/${crossgccTarget} \
"$@"
====


and I then build using:
====
AR_FOR_TARGET=avr-ar \
AS_FOR_TARGET=avr-as \
LD_FOR_TARGET=avr-ld \
NM_FOR_TARGET=avr-nm \
RANLIB_FOR_TARGET=avr-ranlib \
gmake -w "$@"
====

What I get from the compilation ends with:
====
gmake[2]: Entering directory `/Users/ned/src/avr-gcc/build/avr/libstdc ++-v3'
Making all in include
/Users/ned/src/avr-gcc/build/avr/libstdc++-v3/include
gmake[3]: Entering directory `/Users/ned/src/avr-gcc/build/avr/libstdc ++-v3/include'
gmake[3]: Nothing to be done for `all'.
gmake[3]: Leaving directory `/Users/ned/src/avr-gcc/build/avr/libstdc+ +-v3/include'
Making all in libsupc++
/Users/ned/src/avr-gcc/build/avr/libstdc++-v3/libsupc++
gmake[3]: Entering directory `/Users/ned/src/avr-gcc/build/avr/libstdc ++-v3/libsupc++'
/bin/sh ../libtool --tag CXX --tag disable-shared --mode=compile / Users/ned/src/avr-gcc/build/./gcc/xgcc -shared-libgcc -B/Users/ned/ src/avr-gcc/build/./gcc -nostdinc++ -L/Users/ned/src/avr-gcc/build/ avr/libstdc++-v3/src -L/Users/ned/src/avr-gcc/build/avr/libstdc++-v3/ src/.libs -B/opt/local/avr/ bin/ -B/opt/local/avr/lib/ -isystem / opt/local/avr/include -isystem /opt/local/avr/sys-include -I/ Users/ ned/src/avr-gcc/gcc/libstdc++-v3/../gcc -I/Users/ned/src/avr-gcc/ build/avr/libstdc++-v3/ include/avr -I/Users/ned/src/avr-gcc/ build/avr/libstdc++-v3/include -I/Users/ned/src/avr-gcc/gcc/ libstdc ++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite- strings -Wcast-qual - fdiagnostics-show-location=once -g - O2 -c -o eh_exception.lo ../../../../gcc/libstdc++-v3/ libsupc+ +/eh_exception.cc
/Users/ned/src/avr-gcc/build/./gcc/xgcc -shared-libgcc -B/Users/ned/ src/avr-gcc/build/./gcc - nostdinc++ -L/Users/ned/src/avr-gcc/ build/avr/libstdc++-v3/src -L/Users/ned/src/avr-gcc/build/avr/ libstdc++-v3/src/.libs -B/opt/local/avr/bin/ -B/opt/local/avr/lib/ - isystem /opt/local/avr/include -isystem /opt/local/avr/sys-include -I/ Users/ned/src/avr-gcc/gcc/libstdc++-v3/../gcc -I/Users/ned/ src/avr- gcc/build/avr/libstdc++-v3/include/avr -I/Users/ned/src/avr-gcc/build/ avr/libstdc++-v3/ include -I/Users/ned/src/avr-gcc/gcc/libstdc++- v3/libsupc++ -fno-implicit-templates -Wall -Wextra - Wwrite-strings - Wcast-qual -fdiagnostics-show-location=once -g -O2 -c ../../../../gcc/ libstdc++-v3/ libsupc++/eh_exception.cc -o eh_exception.o
../../../../gcc/libstdc++-v3/libsupc++/eh_exception.cc: In member function 'virtual const char* std::exception::what() const':
../../../../gcc/libstdc++-v3/libsupc++/eh_exception.cc:42: error: cannot use typeid with -fno-rtti
gmake[3]: *** [eh_exception.lo] Error 1
gmake[3]: Leaving directory `/Users/ned/src/avr-gcc/build/avr/libstdc+ +-v3/libsupc++'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/Users/ned/src/avr-gcc/build/avr/libstdc+ +-v3'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/Users/ned/src/avr-gcc/build/avr/libstdc+ +-v3'
gmake: *** [all-target-libstdc++-v3] Error 2
gmake: Leaving directory `/Users/ned/src/avr-gcc/build'
====


If I use -k with make, I see that the same problem also exists with:

libstdc++-v3/libsupc++/tinfo2.cc

Earlier, libtool or configure (I'm not sure which) had said (among other things)...
====
checking if /Users/ned/src/avr-gcc/build/./gcc/xgcc supports -fno- rtti -fno-exceptions ... yes
checking whether the linker (/Users/ned/src/avr-gcc/build/./gcc/ collect-ld) supports shared libraries... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... no
checking command to parse /Users/ned/src/avr-gcc/build/./gcc/nm output... failed
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
appending configuration tag "CXX" to libtool
configure: Only freestanding libraries will be built
checking for exception model to use... sjlj
====


I'm sure I'm doing something wrong; the build system is more than a little complicated and I haven't wanted to try to figure the whole thing out yet.

Can anyone give me some guidance here?

Thanks,
--
Ned Konz
MetaMagix embedded consulting
MetaMagix@gmail.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]