Redis Installation fails when running make command

2019-02-07 19:02发布

问题:

Redis installation on RHEL fails when running make command. Below is the output

cd src && make all
make[1]: Entering directory `/root/Downloads/redis-3.2.0/src'
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/Downloads/redis-3.2.0/src'
make: *** [all] Error 2

回答1:

running

make distclean

and then

make

solved the issue



回答2:

Redis creates the redis-server and redis-cli files only after the Dependenices in the /deps directory: hiredis lua jemalloc linenoise are resolved. I had to run the make command in the deps directory more than once to get the depenedencies resolved.

The following are the Steps I followed:

cd <redisInstallationPath> (I have it under /opt/mount1/redis-3.0.7)
make distclean
cd deps/

Resolve dependecies more than once.

make lua hiredis linenoise
make jemalloc
make hiredis
make linenoise

Did the same again as there were a few missing files. I think you just need to get the combination correct. Run the make command more than once till you get it right.

make hiredis lua jemalloc linenoise
make hiredis
make lua 
make jemalloc 
make linenoise

cd /opt/mount1/redis-3.0.7/
make

-> I got some errors here that the file hiredis/libhiredis.a is not found and hence I continued again to resolve dependecies.

cd deps
make jemalloc 
make hiredis

ll hiredis/libhiredis.a -> yields a file

cd /opt/mount1/redis-3.0.7/
make

Now I get the following output:

cd src && make all
make[1]: Entering directory `/opt/mount1/redis-3.0.7/src'
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
CC redis-check-dump.o
LINK redis-check-dump
CC redis-check-aof.o
LINK redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/opt/mount1/redis-3.0.7/src'

You can go to Redis installation path (in my case: /opt/mount1/redis-3.0.7 directory) to start the Server.

src/redis-server

And in another terminal run 'redis-cli' to connect to the Redis Server.

src/redis-cli

Example:

127.0.0.1:6379> incr counter
(integer) 1
127.0.0.1:6379> get counter
"1"
127.0.0.1:6379> exit

I got a solution to my problem through this article http://michael.otacoo.com/redis/redis-first-steps-fetch-install-and-server-creation/



回答3:

It happen due to gcc compiler not available in machine. first install gcc:

$ sudo apt install gcc

then try

make

sure it'll resolve this issue . I tried on ubuntu 18.04.



回答4:

That shouldn't be happening. One possible reason could be that your make tools are way older than current version. To update them run:

yum install make gcc gcc-c++ kernel-devel

This will install minimum packages, but if even that doesn't solves the problem, try installing the complete group:

yum install make gcc gcc-c++ kernel-devel

Read More: https://superuser.com/questions/151557/what-are-build-essential-build-dep



回答5:

I guess the version 3.2.0 lost some files because I have met the same problem as you, I solved it by downloading another redis version 3.0.7, the download link is

http://download.redis.io/releases/redis-3.0.7.tar.gz

Then, decompress the file and run the command as you have done before, just step into the redis directory and type the command 'make'

Good luck with you



回答6:

This error may indicate that you need to run make with sudo: sudo make

You may afterwards run into:

../deps/jemalloc/lib/libjemalloc.a(nstime.o): In function nstime_get':     /opt/redis_src/current/redis-stable/deps/jemalloc/src/nstime.c:120:     undefined reference toclock_gettime'

If so, please see: https://github.com/antirez/redis/issues/3790



标签: redis