Trouble building 32bit version
I have a 64bit Linux system and I need to build boost for 32bit in order to link to this library I have to use. Trouble is that I keep getting this error when I try to link to any boost library: nroberts@Adad:~$ g++ test.cpp -m32 -L/home/nroberts/boost-x86/lib -lboost_thread-gcc44-mt /home/nroberts/boost-x86/lib/libboost_thread-gcc44-mt.so: undefined reference to `__sync_fetch_and_add_4' collect2: ld returned 1 exit status test.cpp just contains an empty main(). I've tried google and arrived at various places: http://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atom... http://old.nabble.com/compiling-32-bit-boost-libraries-on-a-64-bit-system--%... Among others. I'm trying to build version 1.38. Here's my last attempt at supplying bjam with the correct parameters: bjam architecture=x86 address-model=32 toolset=gcc instruction-set=i686 stage It's funny though, even at the link in the reply held at nabble.com the documentation doesn't seem to have anything on any of these parameters. They don't appear in the bjam --help output either. So I seem to be kind of screwed in figuring this out myself. I'm just trying to guess until I get it but I'm out of ideas. What do I need to do? Thanks.
I have a 64bit Linux system and I need to build boost for 32bit in order to link to this library I have to use. Trouble is that I keep getting this error when I try to link to any boost library:
nroberts@Adad:~$ g++ test.cpp -m32 -L/home/nroberts/boost-x86/lib -lboost_thread-gcc44-mt /home/nroberts/boost-x86/lib/libboost_thread-gcc44-mt.so: undefined reference to `__sync_fetch_and_add_4' collect2: ld returned 1 exit status
test.cpp just contains an empty main().
I've tried google and arrived at various places:
http://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atom... bit-mode http://old.nabble.com/compiling-32-bit-boost-libraries-on-a-64-bit-system--%...
Noah Roberts wrote: td22087063.html
Among others. I'm trying to build version 1.38.
Here's my last attempt at supplying bjam with the correct parameters:
bjam architecture=x86 address-model=32 toolset=gcc instruction-set=i686 stage
This seems about right. You might want to add -a --with-thread to completely rebuild the thread library. Then, check timestamp at /home/nroberts/boost-x86/lib/libboost_thread-gcc44-mt.so to make sure it was rebuilt.
It's funny though, even at the link in the reply held at nabble.com the documentation doesn't seem to have anything on any of these parameters. They don't appear in the bjam --help output either. So I seem to be kind of screwed in figuring this out myself. I'm just trying to guess until I get it but I'm out of ideas.
You might want to thanks gcc developers for this mess. __sync_fetch_and_add_4 is a popular error with Boost, especially for not-exactly-native configurations, due to the fact that gcc always provides certain builtin, which sometimes does not work. - Volodya
What do I need to do?
Thanks.
On 08/05/2010 10:12 PM, Vladimir Prus wrote:
Noah Roberts wrote:
Here's my last attempt at supplying bjam with the correct parameters:
bjam architecture=x86 address-model=32 toolset=gcc instruction-set=i686 stage
This seems about right. You might want to add
-a --with-thread
to completely rebuild the thread library. Then, check timestamp at
/home/nroberts/boost-x86/lib/libboost_thread-gcc44-mt.so
to make sure it was rebuilt.
Yeah, it was apparently not rebuilding. I just deleted the whole tree and started over and this time it worked. Thanks.
participants (2)
-
Noah Roberts
-
Vladimir Prus