Running a make (after make distclean) runs for a while until:
In file included from server.c:30:0:
server.h:1059:5: error: expected specifier-qualifier-list before ‘_Atomic’
_Atomic unsigned int lruclock; /* Clock for LRU eviction */
^
server.c: In function ‘serverLogRaw’:
server.c:1018:31: error: ‘struct redisServer’ has no member named ‘logfile’
int log_to_stdout = server.logfile[0] == '\0';
followed by many many lines of similar errors of "has no member named ...".
If I force clang with CC=clang make, then it builds OK.
I tried this first on unstable, and then 5.0.5 branch.
Comment From: itamarhaber
6284 appears to be related too - @antirez
Comment From: petdance
According to my git bisecting on unstable, 6f4f36c0fb9498cee4289655036f6dd12a0bbebb is the commit that causes this.
Comment From: petdance
It seems to be the _Atomic that makes the compile fail. Removing the instances of it from server.h and networking.c makes the compile complete.
Comment From: petdance
6f4f36c0fb9498cee4289655036f6dd12a0bbebb introduces this line in src/networking.c that causes the compile failure under GCC.
a2245f8f ( antirez 2019-03-31 15:58:54 +0200 2576)_Atomic unsigned long io_threads_pending[IO_THREADS_MAX_NUM];
Later, dd5b105c introduces these lines in server.h that have _Atomic
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1059) _Atomic unsigned int lruclock; /* Clock for LRU eviction */
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1101) _Atomic uint64_t next_client_id; /* Next client unique ID. Incremental. */
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1147) _Atomic long long stat_net_input_bytes; /* Bytes read from network. */
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1148) _Atomic long long stat_net_output_bytes; /* Bytes written to network. */
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1171) _Atomic size_t client_max_querybuf_len; /* Limit for client query buffer length */
dd5b105c ( antirez 2019-03-30 11:26:58 +0100 1349) _Atomic time_t unixtime; /* Unix time sampled every cron cycle. */
Comment From: petdance
Just to be sure I tried make 32bit and that failed the same way.
Comment From: vattezhang
6092 can solve this problem, but will result in disable mutli-thread IO function.
Comment From: woodliu
I find a solution from here,using clang compile redis,not gcc
Comment From: trevor211
Please compile using higher gcc version. _Atomic is not supported in gcc lower version.
Comment From: petdance
What's the minimum version of GCC that's necessary to build redis? That would be a good thing to let folks know.
Comment From: anthosz
I have the same issue on RHEL7 with Redis 6-0-rc4
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:1042:5: error: expected specifier-qualifier-list before ‘_Atomic’
_Atomic unsigned int lruclock; /* Clock for LRU eviction */
^
CC sds.o
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");
^
server.c:1046:47: error: ‘struct redisServer’ has no member named ‘timezone’
nolocks_localtime(&tm,tv.tv_sec,server.timezone,server.daylight_active);
^
server.c:1046:63: error: ‘struct redisServer’ has no member named ‘daylight_active’
nolocks_localtime(&tm,tv.tv_sec,server.timezone,server.daylight_active);
^
server.c:1049:19: error: ‘struct redisServer’ has no member named ‘sentinel_mode’
if (server.sentinel_mode) {
^
server.c:1054:32: error: ‘struct redisServer’ has no member named ‘masterhost’
role_char = (server.masterhost ? 'S':'M'); /* Slave or Master. */
......
Comment From: tomck
What's the minimum version of GCC that's necessary to build redis? That would be a good thing to let folks know.
In my testing, using Amazon's AWS Linux (1, not 2), it installs gcc48 if you yum install gcc. If you yum install gcc64, the build works, so do that instead.
Comment From: anthosz
Not possible on my side, RHEL 7.8 (Maipo), gcc (GCC) 4.8.5 and no gcc64 nor clang available.. if someone have an idea with RHEL 7 :) (without recompile gcc)
Comment From: NadeemPatel
@tomck thanks sudo yum install gcc64 worked for me.
Comment From: tessus
@anthosz have you found a solution to that yet? I'm running into the same problem.
Comment From: anthosz
@tessus No, I use V5..
Comment From: danlenar
@anthosz
You can install devtoolset-8, which should give you gcc-8 on RHEL/Centos 7 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
Comment From: anthosz
@anthosz
You can install devtoolset-8, which should give you gcc-8 on RHEL/Centos 7 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
Unfortunately, I'm not root so I need also tu compile gcc from another server :(
Comment From: antirez
Just to clarify: there is no way this issue will be fixed, Redis >= 6 will require a C11 compiler. _Atomic is a fundamental part of making C coding much simpler with threads, and I think we should really go forward with this. Dropping support for platforms that are many years old is ok I believe, people can still run Redis 5 without problems.
Comment From: jwenjian
@anthosz
You can install devtoolset-8, which should give you gcc-8 on RHEL/Centos 7 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
Works for me
Comment From: julianx
It didn't work for me using gcc 10.1.0
gcc --version
gcc (GCC) 10.1.0
In file included from server.c:30:0:
server.h:1045:5: error: expected specifier-qualifier-list before ‘_Atomic’
_Atomic unsigned int lruclock; /* Clock for LRU eviction */
^
Comment From: phamthanhnhan14
server.c: In function ‘iAmMaster’:
server.c:4964:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[1]: *** [server.o] Error 1
make[1]: Leaving directory `/root/redis-stable/src'
make: *** [all] Error 2
Make fail with both stable and version 6.0.5.
@anthosz You can install devtoolset-8, which should give you gcc-8 on RHEL/Centos 7 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
Works for me
Not luck in my case.
Comment From: dmitrypol
I am having same problem as @phamthanhnhan14
Comment From: Aeres-u99
@antirez We should probably include the requirements for compilation or if its there already kindly point me to it.
Comment From: byujiang
Using Clang according here works for me, but make test run into some errors.
Comment From: uronly14me
I did yum install gcc64 and worked fine too! Thanks! @tomck
Comment From: oranagra
Update: The core team have decided to step back from the C11 requirement. We see it causes pain to many, and we feel that the value (in code clarity) is not worth the pain, and that it was too early for Redis to depend on it. We'll reconsider it again in the future. This ticket is closed, and the task will be tracked in #7509.
Comment From: oranagra
Quick update to anyone following this: We understand the pain this issue is causing to many, which is why we decided to undo this change (requirement for C11), but on the other hand we feel that it would not be responsible to release it in a patch level release which might cause some unexpected problems to an innocent upgrade.
The plan is to release 6.2 RC around the end of the year, and hopefully a final somewhere in January.
Comment From: karansharma27
For newer centos/RHEL version, try -
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
Comment From: anthosz
For people that use RHEL 7 without root, you can use RPM available on remi repository. After extraction of rpm, all works.