Boost logo

Boost Users :

Subject: [Boost-users] linking boost in a shared library using -fPIC
From: jono (jp_at_[hidden])
Date: 2009-01-29 20:23:37


hi.

i'm building a shared library under gcc 4.1.1 which links some boost 1.33.1 libraries.

a predecessor added the -fPIC switch to the Jamfiles of boost 'thread', 'date_time' and 'regex', and
i have had no problems linking them.

i've added the boost 'filesystem' library to the project and similarly patched the Jamfile...

.
.
.
lib boost_filesystem
      : ../src/$(SOURCES).cpp
      : # build requirements
        <define>BOOST_FILESYSTEM_STATIC_LINK
        <include>$(BOOST_ROOT) <sysinclude>$(BOOST_ROOT)
        <no-warn>exception.cpp <no-warn>operations_posix_windows.cpp
        #********************
        <gcc><*><cxxflags>"-fPIC"
        #********************
       # common-variant-tag ensures that the library will
       # be named according to the rules used by the install
       # and auto-link features:
       common-variant-tag
      : debug release # build variants
      ;
.
.
.

... and recompiled boost.

but i still get the following linker error.

-------------------------------------------------------------
gcc-Link-action
bin/blablabla/libinterpreter.so/gcc/debug/shared-linkable-true/threading-multi/libinterpreter.so
/usr/bin/ld: /home/jono/lib/boost/bin_linux/debug/libboost_filesystem.a(operations_posix_windows.o):
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object;
recompile with -fPIC
/home/jono/lib/boost/bin_linux/debug/libboost_filesystem.a: could not read symbols: Bad value
-------------------------------------------------------------

can anyone spot my deliberate mistake?

cheers
Jono


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net