Compiling Haskell code in Cygwin, and some other bugs in Haskell Platform on Windows

后端 未结 1 1661
北海茫月
北海茫月 2021-01-19 03:08

I am trying to compile a simple hello world program in Haskell, with Haskell Platform 2011.2.0.1. If I load the code in WinGHCi, and use the GUI to compile, the .exe is crea

相关标签:
1条回答
  • 2021-01-19 03:47

    Without access to your development environment or a listing of the errors that you're getting, I can only assume that the issue is related to the way that you've set up your PATH.

    GHC on Windows comes bundled with its own gcc compiler (for C code) and ld linker. If you've installed Cygwin, you've probably also installed the MinGW toolchain, which comes with its own version of gcc and ld. Then, you've probably made your PATH variable list /usr/bin before the path to the Haskell Platform binary directories, which makes ghc find the MinGW linker and C compiler before it finds the versions that were bundled with GHC.

    You need to make sure that the HP directories are listed before the Cygwin directories. It should not be like this:

    $ echo $PATH
    /bin:/usr/bin:.../2011.2.0.1/bin
    

    Instead, it should be like this:

    $ echo $PATH
    .../2011.2.0.1/bin:/bin:/usr/bin
    

    This is only a guess at what the issue might be, and you should provide more details for a better diagnosis.

    0 讨论(0)
提交回复
热议问题