在vps上面編譯redis 2.6 由於系統有點老,以至於編不過,報錯undefined
reference to
__sync_add_and_fetch_4',google了下,發現好多人遇到我同樣的問題,
zmalloc.o: In function zmalloc_used_memory':
__sync_add_and_fetch_4'
/home/xx/redis-2.6.2/src/zmalloc.c:223: undefined reference to
collect2: ld 返回 1
make[1]: *** [redis-server] 錯誤 1
make[1]: Leaving directory `/home/xx/redis-2.6.2/src'
make: *** [all] 錯誤 2
github上面一兄弟在src/Makefile開頭加 CFLAGS= -march=i686解決了,但是我試了。繼續google,發現google group裏有個兄弟編輯了下src/.make_settings裏的OPT,改爲OPT=-O2 -march=i686。
make過了,但是接下來make test又過不了。報錯如下
You need 'tclsh8.5' in order to run the Redis test
查了下資料,說是要最新的tcl,那就給你裝個最新的吧http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html
安裝完後,總算可以了.原文出處http://marspring.mobi/redis-compile/
參考資料:
https://github.com/antirez/redis/issues/736
https://groups.google.com/forum/#!msg/redis-db/NI_d00he39o/7GLi8uwZ1HEJ