[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to tell the compiler NOT to assume cpu provides atomic instructions



Hi Brian,

On Mon, Mar 7, 2011 at 7:12 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
On Mon, Mar 07, 2011 at 06:27:22PM -0500, RR wrote:
> astobj2.o: In function `ast_atomic_fetchadd_int':
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> astobj2.o:/usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: more
> undefined references to `__sync_fetch_and_add_4' follow
> utils.o: In function `ast_atomic_dec_and_test':
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:635: undefined reference to
> `__sync_sub_and_fetch_4'
> utils.o: In function `ast_atomic_fetchadd_int':
> /usr/src/asterisk-1.8.3/include/asterisk/lock.h:589: undefined reference to
> `__sync_fetch_and_add_4'
> collect2: ld returned 1 exit status
> make[1]: *** [asterisk] Error 1
> make: *** [main] Error 2
>
> Credible people in the Asterisk list believe that it's because the configure
> script is somehow determining that my CPU provides atomic instructions but
> it fails to find it when it tries to link. Does anyone know what options can
> be provided to the "configure" script via CFLAGS or CXXFLAGS etc to tell
> make/compiler about this or to fix this?

Please provide the output of the compilation command line and the
linking command line.  Also, please provide the output of gcc -v.  I
have some conjectures as to what might be going on, but I'll need to do
some tests to see.

Ok, so the output of gcc -v is:

# gcc -v
Using built-in specs.
Target: sparc-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-long-double-128 --enable-checking=release --build=sparc-linux-gnu --host=sparc-linux-gnu --target=sparc-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

umm sorry if this is a stupid question but I don't know what other output to provide other than what I provided above which was from the 'make' command. The beginning of that is:

# make
CC="cc" CXX="" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" makeopts


Reply to: