cmake: fix risc-v build failure

riscv64 is failing due to missing atomic ops in gcc 12.
This commit works around the problem by linking against libatomic.

It can be reverted when we switch to gcc 13 (#268097)
This commit is contained in:
Francesco Gazzetta 2023-11-20 17:41:08 +01:00 committed by Anderson Torres
parent 48dc37ae96
commit 3832b75e4e

View File

@ -138,6 +138,8 @@ stdenv.mkDerivation (finalAttrs: {
"CFLAGS=-D_FILE_OFFSET_BITS=64"
"CXXFLAGS=-D_FILE_OFFSET_BITS=64"
]
# Workaround missing atomic ops with gcc <13
++ lib.optional stdenv.hostPlatform.isRiscV "LDFLAGS=-latomic"
++ [
"--"
# We should set the proper `CMAKE_SYSTEM_NAME`.