From 26326511ef25cec5a0721670ae50db75bfeb0bf0 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 21 Jul 2022 22:03:13 +0100 Subject: [PATCH] sbcl_2_1_10, sbcl_2_1_11: fix build on arm64-darwin (-fno-common fallout) Withut this upstream backport build on arm64-drwin fails as: duplicate symbol '_os_vm_page_size' in: os-common.o arm64-bsd-os.o --- pkgs/development/compilers/sbcl/common.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/development/compilers/sbcl/common.nix b/pkgs/development/compilers/sbcl/common.nix index 3a774754a6cd..05fa6b390897 100644 --- a/pkgs/development/compilers/sbcl/common.nix +++ b/pkgs/development/compilers/sbcl/common.nix @@ -40,6 +40,13 @@ stdenv.mkDerivation rec { url = "https://bugs.launchpad.net/sbcl/+bug/1980570/+attachment/5600916/+files/0001-src-runtime-fix-fno-common-build-on-darwin.patch"; sha256 = "0avpwgjdaxxdpq8pfvv9darfn4ql5dgqq7zaf3nmxnvhh86ngzij"; }) + ] ++ lib.optionals (lib.versionAtLeast version "2.1.10" && lib.versionOlder version "2.2.0") [ + # Fix -fno-common on arm64 + (fetchpatch { + name = "arm64-fno-common.patch"; + url = "https://github.com/sbcl/sbcl/commit/ac3739eae36de92feffef5bb9b4b4bd93f6c4942.patch"; + sha256 = "1kxg0ng7d465rk5v4biikrzaps41x4n1v4ygnb5qh4f5jzkbms8y"; + }) ] ++ lib.optionals (version == "2.2.6") [ # Take contrib blocklist into account for doc generation. This fixes sbcl # build on aarch64, because the docs Makefile tries to require sb-simd, @@ -102,6 +109,14 @@ stdenv.mkDerivation rec { optional (!threadSupport) "sb-thread" ++ optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ]; + NIX_CFLAGS_COMPILE = lib.optional (lib.versionOlder version "2.1.10") [ + # Workaround build failure on -fno-common toolchains like upstream + # clang-13. Without the change build fails as: + # duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o + # Should be fixed past 2.1.10 release. + "-fcommon" + ]; + buildPhase = '' runHook preBuild