Skip to content

Commit

Permalink
cmake: fix risc-v build failure
Browse files Browse the repository at this point in the history
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 (NixOS#268097)
  • Loading branch information
fgaz committed Nov 20, 2023
1 parent b2ebe62 commit b539318
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkgs/by-name/cm/cmake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit b539318

Please sign in to comment.