21

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
Dinei
  • 4,494
  • 4
  • 36
  • 60
Vijay
  • 1,506
  • 2
  • 9
  • 8
  • Does this answer your question? [Issue with Redis install](https://stackoverflow.com/questions/8131008/issue-with-redis-install) – Vega Jun 16 '20 at 19:25

10 Answers10

117

running

make distclean

and then

make

solved the issue

Vijay
  • 1,506
  • 2
  • 9
  • 8
  • 11
    Fixed it for me. I had run make without realizing that I did not yet have gcc installed. After installing gcc, I ran into this error because of the aborted first attempt. This fixed it for me. Thanks! – Daiku Nov 22 '17 at 15:53
  • for redis 4.0.8 still I get error `gcc: Command not found` or `cc: Command not found` – Ori Marko Mar 15 '18 at 13:55
  • This worked on Ubuntu 17 - also because I ran `make` without `gcc` installed – s g Apr 13 '18 at 18:29
  • I am still getting the same error. I did this too yum install make gcc gcc-c++ kernel-devel – Jeff Cook Jul 19 '18 at 17:00
  • This did it for me too, on an Ubuntu terminal in a WSL – Laszlo Sarvold Nov 15 '18 at 12:46
7

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.

manendra
  • 101
  • 1
  • 4
4

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/

Rakesh Venkat
  • 89
  • 1
  • 3
3

Ditch the OS based installation, tried multiple solutions some dependency was always failing

Node to the rescue

There are other ways to install Node and NPM below steps is using Yum on Centos / RHEL

# Add NodeSource yum repository
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -

# Additional dependencies if required
yum install gcc-c++ make -y

# Install Node.js and npm 
yum install nodejs -y

# install redis-cli
npm install -g redis-cli

# connect to redis endpoint
rdcli -h redis.host
 # or
rdcli -h redis.host -a redis.password -p 1111

once connected run

PING

response should be

PONG

to validate the connectivity

cache.amazonaws.com:6379> PING
PONG
Kishore Venkataramanan
  • 6,799
  • 1
  • 12
  • 11
1

In linux

May be some of the files required are missing which can be installed with libc6-dev package.

This worked for me:-

Go to your redis directory and run the following in your terminal:-

sudo apt-get install libc6-dev
make distclean && make
Sm Srikanth
  • 1,992
  • 1
  • 10
  • 10
0

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

Community
  • 1
  • 1
Vikram Tiwari
  • 3,615
  • 1
  • 29
  • 39
0

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

Jerry
  • 492
  • 4
  • 8
0

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

JMess
  • 623
  • 9
  • 11
0

on centos

yum install gcc glibc
tar zxvf redis-5.0.3.tar.gz
cd redis-5.0.3
cd deps
make hiredis jemalloc linenoise lua geohash-int
cd ..
make install
cd utils
./install_server.sh

extra tips

To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128
Michele
  • 31
  • 4
0

You should use Ubuntu PPA

$ sudo add-apt-repository ppa:redislabs/redis
$ sudo apt-get update
$ sudo apt-get install redis
  • This sounds like an opinion and a "your question itself is wrong" — can you elaborate on why Ubuntu PPA should be used and why it is a solution to the problem as presented? – AndrewF Feb 16 '22 at 01:27