Two versions of GCC

Brendon Costa brendon@christian.net
Thu Mar 22 11:22:00 GMT 2007


Hi All,

I have installed on my system two different versions of GCC. I am
finding that while compiling + linking an autotools based example
project using the "new" GCC version, it seems to compile using the
headers for libstdc++ (new version) but tries to link with the libstdc++
(old version). See end for example linker command line that looks
correct to me...

The two versions of GCC are:

One that comes with NetBSD:
Version: 3.3.3
Prefix: /usr

And one i have been modifying as part of a C++ exception source analysis
tool i am writing:
Version: 4.0.1 (patched with my modifications)
Prefix: /home/bcosta/build/install/edoc_gcc


Now the problem i have is that i get undefined symbols while linking
when i compile trying to use the modified GCC. The undefined symbols
belong to libstdc++ and exist in the 4.0.1 GCC version of libstdc++ but
those symbols do NOT exist in the 3.3.3 GCC version of libstdc++

So for some reason i assume it is linking using the
/usr/lib/libstdc++.so file instead of the
/home/bcosta/build/install/edoc_gcc/lib/libstdc++.so


In order to setup my environment to use the modified GCC (4.0.1) i do
the following:

export
LD_LIBRARY_PATH="/home/bcosta/build/install/edoc_gcc/lib:$LD_LIBRARY_PATH"
export PATH="/home/bcosta/build/install/edoc_gcc/bin:$PATH"


Is there something else i should be doing in order to set my build
environment to use the new GCC version (without un-installing the old one)?



Thanks,
Brendon.



The link errors i get look like:

rm -f .libs/library_user.nm .libs/library_user.nmS .libs/library_user.nmT
creating .libs/library_userS.c
extracting global C symbols from
`../../../src/plugins/myplugin/.libs/myplugin.a'
extracting global C symbols from
`/home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a'
extracting global C symbols from
`/home/bcosta/build/install/edoc_gcc/lib/libstdc++.a'
(cd .libs && gcc -c -fno-builtin "library_userS.c")
rm -f .libs/library_userS.c .libs/library_user.nm .libs/library_user.nmS
.libs/library_user.nmT
g++ -g -O2 -o .libs/library_user library_user-main.o
.libs/library_userS.o
-L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src
-L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs
-L/home/bcosta/build/edoc/gcc-4.0.1/gcc
../../../src/plugins/myplugin/.libs/myplugin.a
/home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm
../../../src/libs/myshared/.libs/libmyshared.so
../../../src/libs/mystatic/.libs/libmystatic.a
/home/bcosta/build/install/edoc_gcc/lib/libstdc++.so
../../../libltdl/.libs/libltdlc.a -Wl,--rpath
-Wl,/home/bcosta/build/install_example/lib -Wl,--rpath
-Wl,/home/bcosta/build/install/edoc_gcc/lib
.libs/library_userS.o(.rodata+0x8414): undefined reference to
`__gnu_internal::palloc_init_mutex'
.libs/library_userS.o(.rodata+0x841c): undefined reference to
`__gnu_cxx::__pool_alloc_base::_S_end_free'
.libs/library_userS.o(.rodata+0x842c): undefined reference to
`__gnu_cxx::__pool_alloc_base::_S_free_list'
.libs/library_userS.o(.rodata+0x8434): undefined reference to
`__gnu_cxx::__pool_alloc_base::_S_heap_size'
.libs/library_userS.o(.rodata+0x843c): undefined reference to
`__gnu_cxx::__pool_alloc_base::_S_start_free'
.libs/library_userS.o(.rodata+0x844c): undefined reference to
`__gnu_cxx::__pool_alloc_base::_M_allocate_chunk(unsigned int, int&)'

...






More information about the Gcc-help mailing list