gmp-4.3.2 and 5.0.1 on i386-apple-darwin10 link-fails cxx tests

David Fang fang at csl.cornell.edu
Thu Mar 10 02:05:36 CET 2011


Hello,
 	For gmp-4.3.2 and gmp-5.0.1, I've received reports of the 
following cxx-test link failure on Intel Macs where gmp's config.guess 
reports: i386-apple-darwin10.*

fang at fangbook 31> make -j1 check
make  t-assign t-binary t-cast t-constr t-headers t-istream t-locale 
t-misc t-ops t-ostream t-prec t-rand t-ternary t-unary
/bin/sh ../../libtool --mode=link ccache g++  -m32 -O2 -pedantic 
-fomit-frame-pointer -mtune=i386 -march=i386   -o t-assign  t-assign.o 
-L../../.libs ../../tests/libtests.la ../../libgmpxx.la ../../libgmp.la
ccache g++ -m32 -O2 -pedantic -fomit-frame-pointer -mtune=i386 -march=i386 
-o .libs/t-assign t-assign.o -Wl,-bind_at_load 
-L/Users/fang/local/src/gmp-4.3.2/cross-build/.libs 
../../tests/.libs/libtests.a ../../.libs/libgmpxx.dylib 
/Users/fang/local/src/gmp-4.3.2/cross-build/.libs/libgmp.dylib 
../../.libs/libgmp.dylib
Undefined symbols:
   "___sync_fetch_and_add_4", referenced from:
       check_mpq()    in t-assign.o

The same versions of gmp, however, pass all their tests on my Macbook, a 
core2-apple-darwin10; I was not able to reproduce this problem on a stock 
build with just --enable-cxx as my only configure option. On my 
core2-apple-darwin10, I was able to reproduce the above failures by 
explicitly configuring: --host=i386-apple-darwin10.6.0 
--build=i386-apple-darwin10.6.0

I've seen this report once on this (or a sibling) mailing list, to which 
there was no resolution.

All of the reporters of this problem, and myself are using the same 
compiler:

fang at fangbook 34> gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~89/src/configure --disable-checking 
--enable-werror --prefix=/usr --mandir=/share/man 
--enable-languages=c,objc,c++,obj-c++ 
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib 
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- 
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10 
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)


Does anyone know why this link failure occurs on the older pre-core2 Intel 
Macs?  (Can anyone else confirm this on pre-core2?)  Is this an issue that 
can possibly be worked around?  I've searched include headers and system 
libraries for this symbol, only to find:

/usr/include/c++/4.2.1/ext/atomicity.h

#ifdef _GLIBCXX_ATOMIC_BUILTINS
   static inline _Atomic_word
   __exchange_and_add(volatile _Atomic_word* __mem, int __val)
   { return __sync_fetch_and_add(__mem, __val); }

   static inline void
   __atomic_add(volatile _Atomic_word* __mem, int __val)
   { __sync_fetch_and_add(__mem, __val); }
#else
   _Atomic_word
   __attribute__ ((__unused__))
   __exchange_and_add(volatile _Atomic_word*, int);

   void
   __attribute__ ((__unused__))
   __atomic_add(volatile _Atomic_word*, int);
#endif

Thanks for any insight on this.

Fang

David Fang
http://www.csl.cornell.edu/~fang/
http://www.achronix.com/



More information about the gmp-bugs mailing list