From 01e460d69ecaad102de4aa47370a249d0add3d7d Mon Sep 17 00:00:00 2001 From: Francis Couture-Harpin Date: Thu, 1 Jun 2023 23:29:49 -0400 Subject: [PATCH] perlPackages.HashSharedMem: fix build on aarch64-linux The [(failing-)build log](https://hydra.nixos.org/build/219379873/nixlog/1) has errors that look like: `undefined symbol: __aarch64_cas8_sync`. This led me to find out about the newly-introduced `-moutline-atomics`, which is **on by default** in GCC 10.1 (according to [this blog post](https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10)) and in Clang 12.0.0 (according to [the release notes](https://releases.llvm.org/12.0.0/tools/clang/docs/ReleaseNotes.html)) Not all ARMv8-A processors support atomic stuff like `__aarch64_cas8_sync`, it's only those that are ARMv8.1-A or later that do. Examples of pre-ARMv8.1-A processors include the Cortex-A72 used in the Raspberry Pi 4 (which is how I discovered this problem (I am running `hydra` on it, which indirectly depends on `HashSharedMem`)), and any older ARMv8-A processors. The problem here is solvable either by linking the compiler runtime library (which I did not try, since I don't know exactly which one to use) *or* by simply not generating outlines for atomic operations. I went with the "easier" path (which was also what was was happening in older versions of GCC, I think) of disabling atomic outlines with `-mno-outline-atomics`, and it works! --- pkgs/top-level/perl-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 401a5f9705af..dac7c4979992 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -10912,6 +10912,7 @@ with self; { url = "mirror://cpan/authors/id/Z/ZE/ZEFRAM/Hash-SharedMem-0.005.tar.gz"; hash = "sha256-Mkd2gIYC973EStqpN4lTZUVAKakm+mEfMhyb9rlAu14="; }; + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-mno-outline-atomics"; buildInputs = [ ScalarString ]; meta = { description = "Efficient shared mutable hash";