FS#14268 - libstdc++ not being compiled with -fPIC
Attached to Project:
Arch Linux
Opened by Pierre Bourdon (delroth) - Thursday, 16 April 2009, 21:45 GMT
Last edited by Allan McRae (Allan) - Thursday, 16 April 2009, 22:53 GMT
Opened by Pierre Bourdon (delroth) - Thursday, 16 April 2009, 21:45 GMT
Last edited by Allan McRae (Allan) - Thursday, 16 April 2009, 22:53 GMT
|
Details
Description:
libstdc++ is not being compiled with the -fPIC flag, making it impossible to create shared libraries linked to libstdc++. Linker gives this error : /usr/bin/ld: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../../lib/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../../lib/libstdc++.a: could not read symbols: Bad value Additional info: * I'm using libstdc++ from gcc-libs 4.3.3-1 * I was able to reproduce this on two different computers with Arch 64 + a fresh installation Steps to reproduce: 1) Create a C++ source file named foo.cpp containing : #include <iostream> void foo() { std::cout << 42 << std::endl; } 2) Try to compile it to a shared library, with : g++ -o foo.so -shared foo.cpp |
This task depends upon
Comment by
Pierre Bourdon (delroth) - Thursday,
16 April 2009, 21:50 GMT
Comment by
Pierre Bourdon (delroth) - Thursday,
16 April 2009, 21:54 GMT
Hm, my bad. By adding -fPIC as it should normally be done, the
compilation of this example source file works. However, I'm
getting this problem with every program I compile using autotools
(this includes for example CEGUI). I wonder if it comes from
libtool instead of libstdc++.
Well, sorry for the noise. In fact, this problem was coming from a
/usr/lib/libstdc++.la file which did not belong to any package and
was causing problems. I think this task can be closed.