Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis build failure

I'm attempting to build redis on my aws linux server in order to get access to the redis-cli and connect to my redis instance which is also running successfully in aws.

my gcc is:

gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

I downloaded the source and started the build:

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make distclean      
make

It built the dependencies and then gave me this:

gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/witness.o src/witness.c
ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/background_thread.o src/base.o src/bin.o src/bitmap.o src/ckh.o src/ctl.o src/div.o src/extent.o src/extent_dss.o src/extent_mmap.o src/hash.o src/hooks.o src/large.o src/log.o src/malloc_io.o src/mutex.o src/mutex_pool.o src/nstime.o src/pages.o src/prng.o src/prof.o src/rtree.o src/stats.o src/sz.o src/tcache.o src/ticker.o src/tsd.o src/witness.o
make[3]: Leaving directory `/home/ec2-user/redis-stable/deps/jemalloc'
make[2]: Leaving directory `/home/ec2-user/redis-stable/deps'
    CC adlist.o
    CC quicklist.o
    CC ae.o
    CC anet.o
    CC dict.o
    CC server.o
In file included from server.c:30:0:
server.h:1044:5: error: expected specifier-qualifier-list before ‘_Atomic’
     _Atomic unsigned int lruclock; /* Clock for LRU eviction */
     ^
server.c: In function ‘serverLogRaw’:
server.c:1028:31: error: ‘struct redisServer’ has no member named ‘logfile’
     int log_to_stdout = server.logfile[0] == '\0';
                               ^
server.c:1031:23: error: ‘struct redisServer’ has no member named ‘verbosity’
     if (level < server.verbosity) return;
                       ^
server.c:1033:47: error: ‘struct redisServer’ has no member named ‘logfile’
     fp = log_to_stdout ? stdout : fopen(server.logfile,"a");

...and a lot more

I assume that I must have done something wrong as this is code that undoubtedly builds for everyone else. I'm a java developer with little to no c background. Any pointers will be appreciated.

Jay

like image 225
JayOhBee Avatar asked May 01 '20 00:05

JayOhBee


2 Answers

Appears that gcc >= 4.9 is required to build redis 6x ...

like image 178
samehere Avatar answered Sep 20 '22 01:09

samehere


Problem here is latest Redis version(6.0.7) depends on _Atomic which is not supported in older gcc 4.8.5. One can also compile latest Redis code with clang if updating gcc version is not possible.

$ cd redis-stable
$ CC=clang make
like image 35
Akshay Avatar answered Sep 21 '22 01:09

Akshay