Sphinx를 64bit 머신에 CentOS 32bit에서 빌드를 하는데 다음의 오류가 발생을 했다.

g++  -fno-rtti -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG   -o indexer indexer.o libsphinx.a  -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto    -lodbc -lexpat -ldl -lm -lz  -L/usr/local/lib -lrt  -lpthread
libsphinx.a(sphinx.o): In function `CSphAtomic<long>::Dec()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
libsphinx.a(sphinxexpr.o): In function `CSphAtomic<long>::Dec()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
libsphinx.a(sphinxexpr.o):/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: more undefined references to `__sync_fetch_and_sub_4' follow
libsphinx.a(sphinxrt.o): In function `CSphAtomic<long>::Inc()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3038: undefined reference to `__sync_fetch_and_add_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3038: undefined reference to `__sync_fetch_and_add_4'
libsphinx.a(sphinxrt.o): In function `CSphAtomic<long>::Dec()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
libsphinx.a(sphinxrt.o): In function `CSphAtomic<long>::operator long()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3032: undefined reference to `__sync_fetch_and_add_4'
libsphinx.a(sphinxrt.o): In function `CSphAtomic<long>::Dec()':
/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src/sphinxstd.h:3042: undefined reference to `__sync_fetch_and_sub_4'
collect2: ld returned 1 exit status
make[2]: *** [indexer] Error 1
make[2]: Leaving directory `/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/yhbyun/work/sphinx/sphinx-2.2.6-release/src'
make: *** [all-recursive] Error 1

인터넷을 뒤져서 다음의 해결책을 찾았다.

$ vi src/Makefile

-march=i486 옵션 추가

CPPFLAGS =  -I/usr/local/include -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=i486 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing     -fwrapv   -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv

참고 : undefined reference to sync_fetch_and_add_4