[GHC] #11185: runghc can't find ghc-stage2 on a Windows build

GHC ghc-devs at haskell.org
Wed Dec 9 16:05:01 UTC 2015


#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:/utils/runghc/Main.hs#l56
 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:/utils/runghc/runghc.wrapper
 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


More information about the ghc-tickets mailing list