Boost logo

Boost Users :

Subject: [Boost-users] Recent compilation troubles with gcc atomics
From: tom fogal (tfogal_at_[hidden])
Date: 2009-05-02 15:01:07

Hello all,

Recently I have noted more than one posting to this list with regards
to compilation troubles on some platforms utilizing Gnu C++ or Intel's
C++ compiler. Specifically, I am referring to linking errors with some
of gcc's internal `atomics' functions, e.g. `__sync_fetch_and_add'.
Some searching brings up:,-gcc-4.3,-undefined-reference-to-%60__sync_fetch_and_add_4%27-td23020489.html

I also happen to follow the libstdc++ mailing list, which has just seen
an elucidating post by Joseph S. Myers:

In it, he notes that the availability of these builtins is not solely
a function of the compiler version. In particular, the platform (CPU,
OS, runtime support) seems to be a factor, as well as the backend code
generation options (i.e. -march gcc compiler option).

He also suggests that the only reliable methodology for discovering the
availability of these functions/builtins is by doing link-time tests.
I mention as much because (unverified) I think boost's current solution
is #ifdefs based on architecture and compiler version, which I think is
fighting a losing battle.

I hope this information is useful for those stuck on the problem,
and/or boost developers.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at