QUSIR / staff

Automatically exported from code.google.com/p/staff
Apache License 2.0
0 stars 0 forks source link

librise link failure on debian wheezy #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
$ pwd
~/src/staff/rise
$ make
[ ! -z "obj/x86_64/iberty/" ] && mkdir -p obj/x86_64/iberty/ && cd 
obj/x86_64/iberty/ && ar -x /usr/lib/libiberty_pic.a || true
g++ obj/x86_64/ByteOrder.o obj/x86_64/console.o obj/x86_64/DataEncoder.o 
obj/x86_64/Exception.o obj/x86_64/ExceptionTemplate.o obj/x86_64/Log.o 
obj/x86_64/PerformanceCounter.o obj/x86_64/StreamBuffer.o obj/x86_64/osdl.o 
obj/x86_64/osdllexport.o obj/x86_64/oserror.o obj/x86_64/osprocess.o 
obj/x86_64/ossocket.o obj/x86_64/osthread.o obj/x86_64/DynamicLibrary.o 
obj/x86_64/Process.o obj/x86_64/SignalHandler.o obj/x86_64/ClientSocket.o 
obj/x86_64/RecvSocket.o obj/x86_64/ServerSocket.o obj/x86_64/Socket.o 
obj/x86_64/Encoding.o obj/x86_64/String.o obj/x86_64/AtomicCount.o 
obj/x86_64/CriticalSection.o obj/x86_64/Event.o obj/x86_64/Thread.o 
obj/x86_64/TimerHandler.o obj/x86_64/AddrInfo.o obj/x86_64/AddrInfoReader.o 
obj/x86_64/BfdReader.o obj/x86_64/FileFind.o obj/x86_64/StackTracer.o 
obj/x86_64/XMLAttribute.o obj/x86_64/XMLDecl.o obj/x86_64/XMLDocument.o 
obj/x86_64/XMLFileStream.o obj/x86_64/XMLNamespace.o obj/x86_64/XMLNode.o 
obj/x86_64/XMLValue.o -o out/x86_64/librise.so.1.99.0 -lpthread -lstdc++ -ldl 
-shared -Wl,-soname,librise.so.1.99.0 obj/x86_64/iberty/*.o
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/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-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad 
value
collect2: ld returned 1 exit status

What version of the product are you using? On what operating system?
$ svn info
Path: .
URL: http://staff.googlecode.com/svn/trunk/rise
Repository Root: http://staff.googlecode.com/svn
Repository UUID: 46775792-f812-11dd-b507-8b4ecd5210be
Revision: 566

debian wheezy amd64
gcc version 4.4.5 (Debian 4.4.5-8) 
libstdc++6-4.4

Original issue reported on code.google.com by j...@joergschneider.com on 8 Dec 2011 at 10:08

GoogleCodeExporter commented 9 years ago
Very strange, but why g++ tries to link libstdc++ staticaly? I don't see any 
options like -static-libgcc.

Can you produce compilation log and attach it to this issue?

make distclean && make 2>&1 | tee compile.log

Also, very like that /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a was 
compiled incorrectly (without -fPIC option).

Original comment by loentar on 9 Dec 2011 at 6:16

GoogleCodeExporter commented 9 years ago
I was able to solve the problem by upgrading libstdc++6-4.4-dev to the same 
version as libstdc++6.

> Very strange, but why g++ tries to link libstdc++ staticaly?

That was the key question. 
With the help of strace (my favorite tool) I figured out that g++ fell back to 
the static lib (/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a) after getting 
an error when trying to access the shared lib 
(/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.so). The shared lib was a broken 
symlink. The link apparently broke when I upgraded libstdc++6 to 4.6.1-4 
without upgrading libstdc++6-4.4-dev at the same time.
Sorry to have bothered you with this...

Original comment by j...@joergschneider.com on 9 Dec 2011 at 7:14

GoogleCodeExporter commented 9 years ago
Sure, I'm glad that problem is now solved.

Original comment by loentar on 9 Dec 2011 at 7:27

GoogleCodeExporter commented 9 years ago
The debian bug, which caused this problem has been fixed in gcc-4.6/4.6.2-16 
and gcc-4.7/4.7.0~rc1-1.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=651550

Original comment by j...@joergschneider.com on 3 Mar 2012 at 5:24