Boost logo

Boost Users :

Subject: Re: [Boost-users] regex __sync_fetch_and_add_4 issue when compiling to 32 bit Linux
From: Ákos Maróy (akos_at_[hidden])
Date: 2011-01-20 11:38:06


Bryce,

> Which gcc version? __sync_fetch_and_add_4 is a gcc intrinsic, and it's never
> called directly by Boost code (__sync_fetch_and_add is call, gcc expands that
> to a macro which selects the right version of __sync_fetch_and_add to invoke).

interesting. I'm using gcc 4.4.4, that comes with Ubuntu 10.10

> This sounds like a problem with your toolchain, not with Boost. You might be
> neglecting a flag to gcc to properly target 32bit.

this is what -m32 does. in fact, boost is compiled for 32 bit using the
following flags:

 -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
-march=i386 -pthread -m32 -DBOOST_SP_USE_PTHREADS -DBOOST_ALL_NO_LIB=1
-DBOOST_THREAD_USE_LIB=1 -DNDEBUG

from which -march=i686 and -m32 are the main points here. I tried to
compile the sample code using the exact same flags, but to no avail.

sample code that does not refer to libboost_regex compiles & links fine.

> I could be mistaken about this - the only place in boost that
> __sync_fetch_and_add is called is in smart_ptr and interprocess, so I'm
> assuming that your problem is in one of those calls.

interesting. you're right, a sample code with a simple shared_ptr
reference also fails to link with the same error message, where the code
is the following:

#include <boost/smart_ptr.hpp>

int main(void) {
    boost::shared_ptr<int> p;

    return 0;
}

but: this only happens with boost 1.45.0. with boost 1.44.0, it all
seems to work fine.

interesting...

Akos


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