RedisLabs / redis-cluster-proxy

A proxy for Redis clusters.
GNU Affero General Public License v3.0
994 stars 129 forks source link

proxy.h:79:5: err:unknow type ‘_Atomic’ #11

Open bxeldor opened 4 years ago

bxeldor commented 4 years ago

GCC version is 6.1.0, on unstable branch. Running a make, Error occurred:

In file included from cluster.c:31:0: proxy.h:79:5: err:unknow type ‘_Atomic’ _Atomic uint64_t numclients; ^ proxy.h:79:22: err:expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘attribute’ before ‘numclients’ _Atomic uint64_t numclients; ^

artix75 commented 4 years ago

Could you give me more details about the environment?

whoiswes commented 4 years ago

I can replicate this in RHEL7 with GCC 4.8.5 (which supposedly includes Atomic support backported by RedHat).

In file included from cluster.c:31:0:
proxy.h:83:5: error: unknown type name ‘_Atomic’
     _Atomic uint64_t numclients;
     ^
proxy.h:83:22: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘numclients’
     _Atomic uint64_t numclients;
                      ^
make[1]: *** [cluster.o] Error 1

Let me know if I can provide any other details.

artix75 commented 4 years ago

@bxeldor @whoiswes Are you trying to build it onto ARM architecture?

whoiswes commented 4 years ago

@artix75 - sorry, should have included that. Building on x86_64.

uname

Linux c791qaa 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 EST 2019 x86_64 x86_64 x86_64 GNU/Linux

gcc -v

c791qaa:/data/build/redis-cluster-proxy # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
whoiswes commented 4 years ago

FYI, I am dumb and was able to get this to compile by adding GCC 4.9 via the RedHat SCL:

yum install devtoolset-3-gcc devtoolset-3-gcc-c++   
scl enable devtoolset-3 bash

Sorry for the noise.

artix75 commented 4 years ago

@whoiswes Yes, C11 atomics are supported by GCC 4.9 or later. Thank you for the info. Anyway, I still do not understand why @bxeldor is getting the same problem with GCC 6.1.

If anyone is still getting this error with GCC versions greater than 4.9, please try to add -latomic to FINAL_LIBS in src/Makefile. Thank you.

huxiaozhe commented 4 years ago

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.4/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.5 --with-mpc=/usr/local/mpc-1.0.3
Thread model: posix
gcc version 4.9.4 (GCC) 

environment Centos7

Linux localhost.localdomain 3.10.0-1062.7.1.el7.x86_64 #1 SMP Mon Dec 2 17:33:29 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I add -latomic to FINAL_LIBS on Makefile : FINAL_LIBS=-lm -latomic err :

In file included from cluster.c:30:0:
proxy.h:61:5: error: unknown type name '_Atomic'
     _Atomic uint64_t process_clients;
     ^
proxy.h:61:22: error: expected ':', ',', ';', '}' or '__attribute__' before 'process_clients'
     _Atomic uint64_t process_clients;
                      ^
proxy.h:112:5: error: unknown type name '_Atomic'
     _Atomic uint64_t numclients;
     ^
proxy.h:112:22: error: expected ':', ',', ';', '}' or '__attribute__' before 'numclients'
     _Atomic uint64_t numclients;
huangzhuxing commented 3 years ago

@bxeldor @artix75 FYI:https://github.com/RedisLabs/redis-cluster-proxy/pull/93

WechatIMG261
silencer001 commented 2 years ago

@bxeldor @artix75 FYI:#93

WechatIMG261

it's no used to reslove the question, gcc4 not support c11 standard