Boost logo

Boost Users :

Subject: Re: [Boost-users] x86_64 needs -fPIC issue, anyone successful?
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2010-08-05 19:20:50


Bill Freeman wrote:

> I'm trying to build a library (librets) that links
> against boost libraries in order to build a shared
> library (as part of a SWIG based python extension).
>
> The target machine, as well as all of my development
> machines at the moment, are the x86_64 architecture.
> I've done most of my work on an ubuntu 9.04 box.
>
> I've tried with the boost packages available from
> the ubuntu repositores, and I have also, in case
> those packages were miss-built, successfully
> built (and tried the examples, successfully)
> boost 1.43.0 from source, getting no errors from
> ./bjam install .
>
> In either case, I wind up with the following error
> when trying to build librets:
>
> /usr/bin/ld: /home/f/Desktop/rets/lib/libboost_system.a(error_code.o):
> relocation R_X86_64_32 against `.rodata.str1.1' can not be used when
> making a shared object; recompile with -fPIC
>
> Googling around, this seems to be a problem only
> seen on x86_64 machines. (Why one doesn't need to
> make position independent code for the 32 bit
> machines, if that is in fact true, is beyond me.)
>
>
>
> So, I'm wondering if someone else with this issue
> has already figured out how to get around it.
>
> Or, if not, can someone tell me how to tell the bjam
> stuff to apply -fPIC so that I can try that. (I'm
> an old timer. If it were make based, I could hack
> it myself, but I'm hesitant to learn all about the
> boost build system for what is for me a side task.)
>
> Or if someone knows that the -fPIC won't help, or has
> alternate suggestions, please let me know.
>
> TIA, Bill

You should have a libboost_system.so to link against (which should have, and
probably was, built with -fpic).

Either:
1) You don't have libboost_system.so where linker is looking or

2) Usually these are setup as symlinks,
libboost_system.so -> libboost_system.so.x.y.z

You could be missing the symlink, or it could point to the wrong place.


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