From a421e7bd4a28c69bded8b17888325e31554f61a1 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Tue, 15 Dec 2015 22:09:37 +0100 Subject: [PATCH] ghc-7.10.3: don't pass compiler or linker flags through a response file The new GHC version contains a patch [1] that passes linker and compiler flags to GCC via response files rather than directly on the command-line. This is supposed to be beneficial on Windows and other platforms that have trouble dealing with long argument lists. On NixOS, however, this feature breaks the flag handling provided by gcc-wrapper [2] and therefore causes the entire GHC build to fail. This issue has been reported upstream at [3]. It's not clear yet how to remedy this problem, but until we've figured that out we just don't pass compiler flags in response files on NixOS to fix https://github.com/NixOS/nixpkgs/issues/10752. [1] https://github.com/ghc/ghc/commit/296bc70b5ff6c853f2782e9ec5aa47a52110345e [2] https://github.com/NixOS/nixpkgs/issues/11762 [3] https://ghc.haskell.org/trac/ghc/ticket/11147 --- pkgs/development/compilers/ghc/7.10.3.nix | 1 + ...pass-linker-flags-via-response-files.patch | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/development/compilers/ghc/dont-pass-linker-flags-via-response-files.patch diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index ce6db9127d6..f9f863ca78c 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -33,6 +33,7 @@ stdenv.mkDerivation rec { patches = [ docFixes + ./dont-pass-linker-flags-via-response-files.patch # https://github.com/NixOS/nixpkgs/issues/10752 ]; buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ]; diff --git a/pkgs/development/compilers/ghc/dont-pass-linker-flags-via-response-files.patch b/pkgs/development/compilers/ghc/dont-pass-linker-flags-via-response-files.patch new file mode 100644 index 00000000000..129a34ecd86 --- /dev/null +++ b/pkgs/development/compilers/ghc/dont-pass-linker-flags-via-response-files.patch @@ -0,0 +1,22 @@ +diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs +index 8c3ab1a..47a2da7 100644 +--- a/compiler/main/SysTools.hs ++++ b/compiler/main/SysTools.hs +@@ -414,7 +414,7 @@ runCc dflags args = do + args1 = map Option (getOpts dflags opt_c) + args2 = args0 ++ args1 ++ args + mb_env <- getGccEnv args2 +- runSomethingResponseFile dflags cc_filter "C Compiler" p args2 mb_env ++ runSomethingFiltered dflags cc_filter "C Compiler" p args2 mb_env + where + -- discard some harmless warnings from gcc that we can't turn off + cc_filter = unlines . doFilter . lines +@@ -928,7 +928,7 @@ runLink dflags args = do + args1 = map Option (getOpts dflags opt_l) + args2 = args0 ++ linkargs ++ args1 ++ args + mb_env <- getGccEnv args2 +- runSomethingResponseFile dflags ld_filter "Linker" p args2 mb_env ++ runSomethingFiltered dflags ld_filter "Linker" p args2 mb_env + where + ld_filter = case (platformOS (targetPlatform dflags)) of + OSSolaris2 -> sunos_ld_filter