From 71f10994f2ba24a6069f4c7076097a27c3b91fcb Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 7 May 2022 07:36:11 +0100 Subject: [PATCH] simh: add -fcommon workaround Without the change -fno-common toolchains like upstream gcc-10 or clang-11+ fail to build simh as: $ nix build --impure --expr 'with import ~/nm {}; simh.override { stdenv = clang13Stdenv; }' ... ld: /build/pdp11_io-0c74f0.o:(.bss+0x10c00): multiple definition of `uc15_memsize'; /build/pdp11_cis-17339e.o:(.bss+0x118): first defined here ld: /build/pdp11_io_lib-296a06.o:(.bss+0x8000): multiple definition of `uc15_memsize'; /build/pdp11_cis-17339e.o:(.bss+0x118): first defined here --- pkgs/applications/emulators/simh/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/emulators/simh/default.nix b/pkgs/applications/emulators/simh/default.nix index 1e939538cda..6f3409ec063 100644 --- a/pkgs/applications/emulators/simh/default.nix +++ b/pkgs/applications/emulators/simh/default.nix @@ -22,6 +22,11 @@ stdenv.mkDerivation rec { dontConfigure = true; + # Workaround to build against upstream gcc-10 and clang-11. + # Can be removed when next release contains + # https://github.com/simh/simh/issues/794 + NIX_CFLAGS_COMPILE = [ "-fcommon" ]; + makeFlags = [ "GCC=${stdenv.cc.targetPrefix}cc" "CC_STD=-std=c99" "LDFLAGS=-lm" ]; preInstall = ''