无法编译格拉斯哥 Haskell 编译器

The*_*nce 2 haskell compiling

./configure
checking for gfind... no
checking for find... /usr/bin/find
checking for sort... /usr/bin/sort
checking for ghc... no
configure: error: GHC is required unless bootstrapping from .hc files.
256
Run Code Online (Sandbox Code Playgroud)

我想安装 Glasgow Haskell Compiler,并且 ./configure 要求 GHC。它要求什么样的 GHC?全球强子对撞机?我从http://www.haskell.org/ghc/download_ghc_7_6_3下载了源代码

kar*_*rel 7

从结果来看apt-cache show ghc

The Glasgow Haskell Compilation system (GHC) is a compiler for Haskell.  
Run Code Online (Sandbox Code Playgroud)

要安装 ghc,请打开终端并输入:

sudo apt-get install ghc  
Run Code Online (Sandbox Code Playgroud)

创建一个示例 Haskell 源文件 example.hs,其中包含:main = putStrLn "Hello, World!"要编译 example.hs cd,请将目录更改为包含 example.hs 的目录并键入:

ghc -o example example.hs  
Run Code Online (Sandbox Code Playgroud)

要运行可执行文件:

./example  
Run Code Online (Sandbox Code Playgroud)

  • 在 Ubuntu 软件中心的软件源中启用 _Source code_。它是列表中的最后一个软件源。打开终端并输入:`cd ~/Desktop`(为了将源代码下载到你的桌面),然后输入`sudo apt-get source ghc`。这会将 4 个不同的文件下载到您的桌面。 (2认同)