Ticket #355 (closed defect: fixed)
sprcal3d fails to link on ubuntu with gcc 4.1.2
|Reported by:||dave.bentham@…||Owned by:||sunshine|
|Priority:||minor||Milestone:||Version 1.4 pre1|
|Keywords:||sprcal3d fpic visibility hidden||Cc:|
Description (last modified by sunshine) (diff)
Reproduced from CS-forum:1359
Hi, Ive been building CS on Ubuntu Edgy for some time for the Planeshift game.
But then I did the Ubuntu online upgrade to Feisty Fawn, and now I cannot build CS (r26888) plugins, as the link fails as follows. I am not familiar with the CS code; I just kinda expected it all to just work after the upgrade. Any ideas? Thanks, Dave
LinkPlugin sprcal3d.so ./out/linux/debug/plugins/mesh/sprcal3d/object/sprcal3d.o: In function `CS::Plugin::SprCal3d::csCal3dSkeletonBone::Initialize()': /home/dave/projects/planeshift-dev/cs/plugins/mesh/sprcal3d/object/sprcal3d.cpp:2411: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const' /usr/bin/ld: ./out/linux/debug/plugins/mesh/sprcal3d/object/sprcal3d.o: relocation R_X86_64_PC32 against `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status g++ -Wl,--as-needed -o sprcal3d.so ./out/linux/debug/plugins/mesh/sprcal3d/object/sprcal3d.o -lm -ldl -lnsl -L/usr/local/lib -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,-E -g3 -shared ./out/linux/debug/libs/libcrystalspace-1.1.a -lpthread -lpthread -lz -L/home/dave/projects/planeshift-dev/cal3d/lib -lcal3d -lm -ldl -lnsl -L/usr/local/lib -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,-E -g3 \ -Wl,-soname,sprcal3d.so ...failed LinkPlugin sprcal3d.so ...
btw, its the 64-bit version, gcc 4.1.2.
A work around seems to be:
Removing the following from Jamconfig helps...
COMPILER.C++FLAGS += "-fvisibility-inlines-hidden" ; COMPILER.CFLAGS += "-fvisibility=hidden" ;
I dont know if thats the correct solution, but it works for me.