automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R_X86_64_32S error building a shared library


From: Adam Nielsen
Subject: Re: R_X86_64_32S error building a shared library
Date: Sun, 25 Jan 2009 14:46:07 +1000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.8.1.18) Gecko/20081215 Thunderbird/2.0.0.18 Mnenhy/0.7.5.0

Hi Ralf,

Thanks for your reply, and sorry about taking so long to follow up!

x86_64-pc-linux-gnu/bin/ld: .../lib64/libboost_system-mt-1_37.a(error_code.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
.../lib64/libboost_system-mt-1_37.a: could not read symbols: Bad value

Please post the full command that causes this (libtool --mode=link ...)
including all of its output.

This is going to look horrible ;-) Here's the whole compile sequence, one file (main.cpp) being compiled into a shared library (libtest.la) Blank lines added for readability.

$ make

/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include/boost-1_37 -fPIC -g -O2 -MT libtest_la-main.lo -MD -MP -MF .deps/libtest_la-main.Tpo -c -o libtest_la-main.lo `test -f 'main.cpp' || echo './'`main.cpp

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include/boost-1_37 -fPIC -g -O2 -MT libtest_la-main.lo -MD -MP -MF .deps/libtest_la-main.Tpo -c main.cpp -fPIC -DPIC -o .libs/libtest_la-main.o

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include/boost-1_37 -fPIC -g -O2 -MT libtest_la-main.lo -MD -MP -MF .deps/libtest_la-main.Tpo -c main.cpp -o libtest_la-main.o >/dev/null 2>&1
mv -f .deps/libtest_la-main.Tpo .deps/libtest_la-main.Plo

/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -R/usr/local/lib -o libtest.la -rpath /usr/local/lib libtest_la-main.lo -lboost_system-mt-1_37 -lboost_filesystem-mt-1_37

libtool: link: g++ -shared -nostdlib /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbeginS.o .libs/libtest_la-main.o -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib -lboost_system-mt-1_37 -lboost_filesystem-mt-1_37 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2 -L/ usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/crtn.o -Wl,-soname -Wl,libtest.so.0 -o .libs/libtest.so.0.0.0



/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libboost_system-mt-1_37.a(error_code.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libboost_system-mt-1_37.a: could not read symbols: Bad value

collect2: ld returned 1 exit status
make: *** [libtest.la] Error 1

The $(BOOST_*) variables are set by the "boost.m4" file from the Boost website. This does work fine if I use $(BOOST_*) in my executable, but it doesn't work with the shared library.

Please post an URL to the macro file you have downloaded (IIRC there is
more than one set of such macros).

http://repo.or.cz/w/boost.m4.git (I used the wget command listed on that page)

It may be necessary to also see the output of configure

The Boost-related part seems fine:

checking for Boost headers version >= 103700... /usr/include/boost-1_37
checking for Boost's header version... 1_37
checking for the toolset name used by Boost for g++... gcc43
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... yes
checking boost/filesystem/path.hpp usability... yes
checking boost/filesystem/path.hpp presence... yes
checking for boost/filesystem/path.hpp... yes
checking for the Boost filesystem library... yes
checking boost/program_options.hpp usability... yes
checking boost/program_options.hpp presence... yes
checking for boost/program_options.hpp... yes
checking for the Boost program_options library... yes
configure: creating ./config.status

and/or parts of config.log in order to fully
understand what's going on, but I'll be able to ask more specific
questions with the information asked above.

Let me know what else you need. Like I say it compiles fine into an executable, but not into a shared library.

Many thanks,
Adam.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]