automake
[Top][All Lists]
Advanced

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

R_X86_64_32S error building a shared library


From: Adam Nielsen
Subject: R_X86_64_32S error building a shared library
Date: Wed, 21 Jan 2009 21:32:57 +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 all,

I've decided to bite the bullet and finally learn how to use autoconf, and so far I seem to be doing okay except for the final step in the build process. I'm trying to create a shared library, and some code in the library uses Boost. Since users of my library do not have to use Boost in their code, I want my shared library to be linked to the Boost libraries, so that users of my library don't need to link to the Boost libraries themselves.

Unfortunately I can't seem to get this to work - I keep getting this error:

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

I even tried re-running the commands by hand, adding in -fPIC but I still get the error. Does anyone know what this error means, or how I'm supposed to link other shared libraries in with my own shared library?

This is my Makefile.am at the moment:

lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = main.cpp $(top_srcdir)/include/gamearchive.hpp
libtest_la_CPPFLAGS = $(BOOST_CPPFLAGS)
libtest_la_LDFLAGS = $(BOOST_SYSTEM_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS)
libtest_la_LIBADD = $(BOOST_SYSTEM_LIBS) $(BOOST_FILESYSTEM_LIBS)

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.

Any pointers would be much appreciated!

Many thanks,
Adam.




reply via email to

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