Describe the bug

We need a way to get atomic support for GCC in the make process. On ARM7 e.g. we get /usr/bin/ld: server.o: in function resetServerStats': path/redis-6.2.6/src/server.c:3115: undefined reference to__atomic_store_8' To reproduce

download redis-6.2.6. run make USE_SYSTEMD=yes BUILD_TLS=yes or try make USE_SYSTEMD=yes BUILD_TLS=yes CFLAGS="_latomic"

Expected behavior

finished & succeeded build

Additional information

In some architectures, e.g. ARM, support for atomic in libc is missing]

Comment From: yossigo

@egbertn I guess you're referring to libc, not libstdc++ (Redis is not written in C++). I see this is already checked by the Makefile, can you please provide some more information: * What OS / compiler do you use? * What does uname -a produce on your system?

Comment From: egbertn

Linux ... 5.15.27-v8+ #1531 SMP PREEMPT Wed Mar 9 11:36:50 GMT 2022 aarch64 GNU/Linux gcc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110

Comment From: egbertn

if I execute this... I get 'yes'

echo "#include " > foo.c; cc -std=c11 -c foo.c -o foo.o > /dev/null 2>&1; if [ -f foo.o ]; then echo "yes"; rm foo.o; fi;

Comment From: yossigo

@egbertn So apparently we dropped -latomic on aarch64 because it is not always needed or available (see #8839), but this is probably not universally correct. We'll need to come up with a more reliable method to determine that.

Comment From: egbertn

@yossigo Great. FYI when I hard code it to '' instead of 'yes' it also fails.