From 7af3fcd424e54114ccc44527366bbdf973e08f5b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 27 Nov 2021 21:23:58 +0000 Subject: [PATCH] sasquatch: pass -fcommon to fix build on -fno-common toolchains Without the change build on clang-12 or upstream gcc-12 fails as: $ nix build --impure --expr 'with import ./. {}; sasquatch.override { stdenv = clang12Stdenv; }' -L ... c++ ./LZMA/lzmalt/*.o ... -o sasquatch ld: squashfs-tools/./error.h:34: multiple definition of `verbose'; unsquashfs.o:error.h:34: first defined here Until upstrea fixes it by fixing `verbose` variable declaration at: https://github.com/devttys0/sasquatch/pull/44 and fork rebases let's set `-fcommon` explicitly. --- pkgs/tools/filesystems/sasquatch/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/filesystems/sasquatch/default.nix b/pkgs/tools/filesystems/sasquatch/default.nix index 017fda14cc653..4db9f8b446331 100644 --- a/pkgs/tools/filesystems/sasquatch/default.nix +++ b/pkgs/tools/filesystems/sasquatch/default.nix @@ -45,7 +45,10 @@ stdenv.mkDerivation rec { postPatch = '' # Drop blanket -Werror to avoid build failure on fresh toolchains # like gcc-11. - substituteInPlace squashfs-tools/Makefile --replace ' -Werror' ' ' + # Add -fcommon as a woarkaround for compiler that default to -fno-common + # like upstream gcc-10 or clang-11. Will be fixed upstream at: + # https://github.com/devttys0/sasquatch/pull/44 + substituteInPlace squashfs-tools/Makefile --replace ' -Werror' ' -fcommon' cd squashfs-tools '';