I was trying to compile Redis 2.6.4 on CentOS 5.8 but I was getting the following error after running make

zmalloc.o: In function zmalloc_used_memory': /root/redis-2.6.4/src/zmalloc.c:223: undefined reference to __sync_add_and_fetch_4' collect2: ld returned 1 exit status make[1]: * [redis-server] Error 1 make[1]: Leaving directory `/root/redis-2.6.4/src' make: * [all] Error 2

I also tried CFLAGS= -march=i686 in the src/Makefile but did not work. Actually, I don't know where to put it. I put at the top of the file.

有帮助吗?

解决方案 2

Ok, I got it done. I run the following command which seems worked correctly (though later I need to install tcl8.5).

make 32bit

其他提示

1 add CFLAGS= -march=i686 to src/Makefile top

2 change src/.make_settings OPT=-O2 into OPT=-O2 -march=i686

3 then make 32bit

4 make test

That works for me.

Ps. maybe you would got tcl problem

1 rpm -qa | grep tcl to see whether tcl version is blow 8.5

2 if so yum remove tcl

3 go to http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html to got a newest one and install

4 go to redis directory make test

As @HungryCoder said, simple "make 32bit" command would work.

But sometimes, if your have already run into error, you'd better remove files named .make* before running it.

make distclean
make

If it didn't help, try to figure out your CPU arch manually by run the following:

export CFLAGS=`uname -m`
make distclean
make

I had some issues compiling it and I solved by first installing the following dependencies:

sudo yum -y install libstdc++*
sudo yum -y install libstdc++*.i686

Then I could run the proper make without any problem

make 32bit

I hope this helps someone.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top