[GHC] #11185: runghc can't find ghc-stage2 on a Windows build
#11185: runghc can't find ghc-stage2 on a Windows build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Keywords: | Operating System: Windows Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- (Originally [https://mail.haskell.org/pipermail/ghc- devs/2015-December/010729.html reported] on the ghc-devs mailing list.) After completing a stage-2 GHC build on Windows, `runghc` does not work at all. Calling it on any file will result in the following error: {{{ $ .\ghc\inplace\bin\runghc.exe Z.hs runghc.exe: C:\Users\ryanscot\Documents\Software\ghc\inplace\bin\ghc: rawSystem: does not exist (No such file or directory) }}} A workaround is to make a symlink to `ghc-stage2` with `ln -s ghc- stage2.exe ghc.exe` in MSYS2. This leads me to believe that Windows' `runghc` is always looking for `ghc` even when it ''should'' be looking for `ghc-stage2` in this particular scenario. [http://git.haskell.org/ghc.git/blob/1f1c7c610b0ff26dccaef089e27003497fa25beb... This code] in `runghc` looks highly suspect: {{{#!hs let ghc = takeDirectory (normalise path) </> "ghc" in uncurry (doIt ghc) $ getGhcArgs args' }}} It probably shouldn't be hardcoding the name `"ghc"` here. On Unix-like OSes, this doesn't appear to be an issue since `runghc` invokes a [http://git.haskell.org/ghc.git/blob/6d17125dccda76b7aafe33181df822045ff5b9bf... shell script] that detects the proper `ghc` name and invokes the `runghc` ''executable''. On the other hand, I believe on Windows calling `runghc` directly invokes the executable, so the proper name detection never happens. What would be a proper fix for this? I'm tempted to just have `runghc` check for `ghc-stage2`'s existence and fall back on `ghc`, but I'd like to get the opinions of people familiar with the build system so that the fix is robust. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11185> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11185: runghc can't find ghc-stage2 on a Windows build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1621 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D1621 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11185#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11185: runghc can't find ghc-stage2 on a Windows build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1621 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"05a5ebed916dc00bc5761224047440fefe10485e/ghc" 05a5ebed/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="05a5ebed916dc00bc5761224047440fefe10485e" Fix runghc when $1_$2_SHELL_WRAPPER = NO When that variable isn't on (which is always the case on Windows), `runghc` naively attempts to invoke `ghc` by finding an executable simply named `ghc`. This won't work if `ghc` doesn't exist (e.g., if we're building GHC and using `ghc-stage2` instead). A simple fix is to test for the existence of `ghc` beforehand, and if that fails, fall back on `ghc-stage2`. Fixes #11185. Test Plan: ./validate Reviewers: austin, hvr, thomie, bgamari Reviewed By: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1621 GHC Trac Issues: #11185 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11185#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11185: runghc can't find ghc-stage2 on a Windows build -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: fixed | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1621 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11185#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC