error: __sync_fetch_and_add_4 is not defined means sync_fetch_and_add isnt
hahah! there are 5+ "standard atomic libs" (+kernel support) that's hardly atomic if you ask me. but ignore it, is all a timely distraction.
so your building, ie glibc and get that error (i did)
glibc-2.11.x expects gcc-4.4.x to define it internally, and you have gcc sans built-in atomic, likely you didnt specify arch that gcc accepts (due to lacky directions). were glibc likes 786, gcc wants 386 and figures 786 maybe. use "native" should do it. opt(march) and opt(mtune) ARE NON OPTIONAL gcc builds wrong w/o them (likely)
you won't find a header or libfoo that defines it
for linux-gnu you might use (a simple for moi build)
cd gcc-4.4.foo
./configure --with-glibc-version=2.11 --enable-threads=posix \
--disable-cloog --disable-ppl --disable-libssp --enable-__cxa_atexit \
--disable-rpath --disable-nls --disable-bootstrp --disable-multilib \
--with-system-libunwind
IMPORTANT: if you build gcc w/o known arch it wont have sync_fetch_and_add
(p.s. glibc sync_fetch_and_add_4 is just macro for sync_fetch_and_add which, aga
in, glibc expects is defined)
also if you replace gcc-3.foo with gcc-4.4.foo and are compiling you may need:
[ -n "$newgnu" ] && CFLAGS="$CFLAGS -march=native -mtune=native "
[ -n "$newgnu" ] && \
CFLAGS="$CFLAGS -std=gnu89 " && CPPFLAGS="$CPPFLAGS -std=gnu89 "
i newly need this (newgnu) to build binutils-ver/: -Wstrict-aliasing=0
cd glibc-2.foo/
./configure --with-headers=/usr/src/linux/usr/include \
--enable-kernel=2.2.foo \
--disable-profile --disable-sanity-checks --with-tls
--disable-rpath --disable-nls
* thanks guy in holland for posting --std that might be an issue for gcc upgraders !
* no thanks to comittees continually changing and also creating "standards" that make depends problems in gcc
use .h or .c appropriately to get your features for you project like everyone else !!
*** all this sync_fetc_ bull added up to: a single asm instruction to "lock" (386 nmemonics) added in your code. horay you could have darn typed in the assembler quicker had you knew what the holdup was and where ! isn't progress nice ...
have fun