[GHC] #8596: windows link failure due to excessively long gcc commad line "Unable to start C:\Program Files\Haskell + Platform\2013.2.0.0\mingw\bin/realgcc.exe (error code: 87)"

#8596: windows link failure due to excessively long gcc commad line "Unable to start C:\Program Files\Haskell + Platform\2013.2.0.0\mingw\bin/realgcc.exe (error code: 87)" ----------------------------+--------------------------------- Reporter: joeyhess | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Windows Architecture: x86 | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------+--------------------------------- I have a program (git-annex) which builds successfully on windows, but when I enable any of three optional features which pull in some additional libraries, it fails to link. I will attach the output of cabal build --ghc-options=-v for a failing and a successful build. I hypothesize this is due to a command line length limit. The final failing gcc link command is 43814 characters, vs 30765 in the configuration that succeeds. Right around the 32k boundry. Not sure what I can do to work around this, short of splitting up my program into standalone libraries which will link without referencing every individual module? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: windows link failure due to excessively long gcc commad line "Unable to start C:\Program Files\Haskell + Platform\2013.2.0.0\mingw\bin/realgcc.exe (error code: 87)" ---------------------------------+--------------------------- Reporter: joeyhess | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by refold): `gcc` has a feature called [http://gcc.gnu.org/wiki/Response_Files response files] that allows to work around this problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: windows link failure due to excessively long gcc commad line "Unable to start C:\Program Files\Haskell + Platform\2013.2.0.0\mingw\bin/realgcc.exe (error code: 87)" ---------------------------------+--------------------------- Reporter: joeyhess | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by joeyhess): Thanks, that's really helpful. Is there any interface in ghc to use response files? If not, please consider this a feature request. ;) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: windows link failure due to excessively long gcc commad line "Unable to start C:\Program Files\Haskell + Platform\2013.2.0.0\mingw\bin/realgcc.exe (error code: 87)" ---------------------------------+--------------------------- Reporter: joeyhess | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by joeyhess): I have verified that I can use response files to link my program. Currently generating the file from ghc -v output: cabal build --ghc-options='-v -keep-tmp-files' > build.log 2>&1 grep '"dist\\build\\git-annex\\git-annex.exe"' build.log | sed -e 's/^"[^"]*" //' -e 's/\\/\//g' > gcc.opt gcc @gcc.opt Refold probably saved me weeks of refactoring into libraries. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: Windows | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * type: bug => feature request * architecture: x86 => Unknown/Multiple -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by Phyx-): * related: => #10777 #9685 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by snoyberg): * owner: => snoyberg -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by snoyberg): I've sent a diff for this: https://phabricator.haskell.org/D1158 Unfortunately, I haven't been successful yet at building GHC on Windows, so I haven't tested there yet. If someone who's experienced this problem has success building with that change, please report back. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by philipp): Hi Michael, thanks for your patch. I compiled ghc 7.10.2 with your patch on windows. Unfortunately, I still get an error when I try to build my project. While trying to link the executable, I get {{{ gcc.exe: error: CreateProcess: No such file or directory }}} Any ideas what the reason could be? If I can help in diagnosing this further, please let me know. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by snoyberg): Yes, the problem is that the GCC toolchain that ships with GHC 7.10 does not itself use response files internally when calling itself for linking. We diagnosed this here, including a short-term (hacky) fix: https://github.com/commercialhaskell/stack/issues/795#issuecomment-134758338 In order to get this included in GHC 7.10.3, https://ghc.haskell.org/trac/ghc/ticket/10726 has been set to merge status. Once that's backported, the ghc-7.10 branch should just work. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by philipp): Thanks! I can happily confirm that using the new version of mingw solved the problem for me :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8596: Add support for "reponse files" to workaround Windows command line length
limitations
-------------------------------------+-------------------------------------
Reporter: joeyhess | Owner: snoyberg
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Windows | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #10777 #9685 | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#8596: Add support for "reponse files" to workaround Windows command line length limitations -------------------------------------+------------------------------------- Reporter: joeyhess | Owner: snoyberg Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10777 #9685 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8596#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC