Skip to content

Commit

Permalink
ghc-7.10.3: don't pass compiler or linker flags through a response file
Browse files Browse the repository at this point in the history
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 #10752.

[1] ghc/ghc@296bc70
[2] #11762
[3] https://ghc.haskell.org/trac/ghc/ticket/11147
  • Loading branch information
peti committed Dec 16, 2015
1 parent eae27e7 commit a421e7b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/development/compilers/ghc/7.10.3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a421e7b

Please sign in to comment.