I figured it out.

It was an obscure, seemingly undocumented option to bjam:

instruction-set=i686

 

i.e

bjam architecture=x86 address-model=32 instruction-set=i686 --stagedir=stage32 --with-filesystem --with-thread --with-signals --with-serialization --with-system --with-program_options --with-date_time stage

 

Could anyone point me to where I would have found that without grepping gcc.jam?

 

 

From: Birju Prajapati
Sent: 24 April 2009 13:12
To: boost-users@lists.boost.org
Subject: undefined reference to `__sync_fetch_and_add_4'

 

Hi,

I built boost 1.38 as so:

bjam architecture=x86 address-model=32 --stagedir=stage32 --with-filesystem --with-thread --with-signals --with-serialization --with-system --with-program_options --with-date_time stage

 

Copied the files over to /usr/local/lib32:

sudo cp stage32/lib/* /usr/local/lib32/

 

Compiled object files, eg:

g++ -m32   -c -g -D_LINUX -I. -I/opt/sts_vendor/onix-eurex/include -I/usr/local/include/boost-1_38 -MMD -MP -MF build/Debug/GNU-Linux-x86/reference/ReferenceData.o.d -o build/Debug/GNU-Linux-x86/reference/ReferenceData.o reference/ReferenceData.cpp

 

Then linking does not work:

g++ -m32    -o dist/Debug/GNU-Linux-x86/spreadx build/Debug/GNU-Linux-x86/multicast/MulticastChannel.o build/Debug/GNU-Linux-x86/reference/ReferenceData.o build/Debug/GNU-Linux-x86/reference/Strategy.o build/Debug/GNU-Linux-x86/executor/MessageExecutor.o build/Debug/GNU-Linux-x86/multicast/MulticastSelector.o build/Debug/GNU-Linux-x86/fast/FIXStreamSubscriber.o build/Debug/GNU-Linux-x86/reference/Product.o build/Debug/GNU-Linux-x86/spreadx.o build/Debug/GNU-Linux-x86/fast/FIXMessage.o build/Debug/GNU-Linux-x86/multicast/Message.o build/Debug/GNU-Linux-x86/fast/FastDecoder.o build/Debug/GNU-Linux-x86/reference/Outright.o -L/opt/sts_vendor/onix-eurex/lib -L/usr/tibco/tibrv/lib -L/usr/local/lib32 -lffCppFixEngine -lACE -lcrypto -lboost_serialization-gcc43-mt -lboost_system-gcc43-mt -lboost_thread-gcc43-mt

/usr/local/lib32/libboost_serialization-gcc43-mt.so: undefined reference to `__sync_fetch_and_add_4'

 

I’ve tried #define BOOST_SP_USE_PTHREADS in user.hpp, I’ve tried –march=i486, but neither works.

 

What gives?

 

My platform details:

birju@xx:~$ g++ --version

g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2

Copyright (C) 2008 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

birju@xx:~$ uname -a

Linux xx 2.6.27-11-generic #1 SMP Wed Apr 1 20:53:41 UTC 2009 x86_64 GNU/Linux

birju@xx:~$

 

Cheers,

Birju

 

 

 

Schneider Trading
4th Floor,
25 Copthall Avenue
London EC2R 7BP


Message from: Birju.Prajapati@schneidertrading.com
Message to: boost-users@lists.boost.org
Attached files: 0

This e-mail and any files transmitted with it are confidential, may be legally privileged, and are for the sole use of the intended recipient. Copyright in this e-mail and any accompanying document created by us is owned by us. If you are not the intended recipient of this e-mail or any part of it please telephone our IT Department at the number shown above or by e-mail at info@schneidertrading.com.

You should not use or disclose to any other person the contents of this e-mail or its attachments (if any), nor take copies. This e-mail is not a representation or warranty and is not intended nor should it be taken to create any legal relations, contractual or otherwise.

Schneider Trading Associates Ltd (Registration No. 3692131) is incorporated in England and Wales and the registered office is at 25 Copthall Avenue, London EC2R 7BP. The company is authorised and regulated by the Financial Services Authority