Boost logo

Boost Users :

Subject: [Boost-users] x86_64 needs -fPIC issue, anyone successful?
From: Bill Freeman (bfreeman_at_[hidden])
Date: 2010-08-05 18:03:05


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


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