我正在尝试直接按照此处的说明在jupyter 中安装 IHaskell 。
我跑了以下。
sudo apt-get install -y python3-pip git libtinfo-dev libzmq3-dev libcairo2-dev libpango1.0-dev libmagic-dev libblas-dev liblapack-dev
git clone https://github.com/gibiansky/IHaskell
cd IHaskell
pip3 install -r requirements.txt
stack install gtk2hs-buildtools
# stack install --fast
# ihaskell install --stack
# jupyter labextension install ihaskell_jupyterlab
我在上面的第 5 个命令中遇到了这个错误,即gtk2hs-buildtools
:
(envname) me@machine:~/plc/IHaskell$ stack install gtk2hs-buildtools
Linking /home/me/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 ...
/home/me/anaconda3/envs/envname/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
`x86_64-conda_cos6-linux-gnu-cc' failed in phase `Linker'. (Exit code: 1)
-- While building simple Setup.hs using:
/home/me/.stack/programs/x86_64-linux/ghc-8.4.4/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-2.2.0.1 /home/me/.stack/setup-exe-src/setup-mPHDZzAJ.hs /home/me/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /home/me/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4
Process exited with code: ExitFailure 1
一些搜索告诉我cannot find -lgmp
是通过以下方式解决的:
$ sudo apt-get install libgmp3-dev
我这样做了。这安装成功,但是
(envname) me@machine:~/plc/IHaskell$ stack install gtk2hs-buildtools
仍然产生相同的错误。出了什么问题,我该如何解决?
从 scinart 的建议更新
$ conda install gmp
Solving environment: done
## Package Plan ##
environment location: /home/me/anaconda3/envs/envname
added / updated specs:
- gmp
The following packages will be downloaded:
package | build
---------------------------|-----------------
openssl-1.0.2p | h470a237_1 3.1 MB conda-forge
ca-certificates-2018.10.15 | ha4d7672_0 135 KB conda-forge
certifi-2018.10.15 | py36_1000 138 KB conda-forge
gmp-6.1.2 | hfc679d8_0 676 KB conda-forge
------------------------------------------------------------
Total: 4.0 MB
The following packages will be UPDATED:
ca-certificates: 2018.03.07-0 --> 2018.10.15-ha4d7672_0 conda-forge
certifi: 2018.10.15-py36_0 --> 2018.10.15-py36_1000 conda-forge
openssl: 1.0.2p-h14c3975_0 --> 1.0.2p-h470a237_1 conda-forge
The following packages will be DOWNGRADED:
gmp: 6.1.2-h6c8ec71_1 --> 6.1.2-hfc679d8_0 conda-forge
Proceed ([y]/n)? y
Downloading and Extracting Packages
openssl-1.0.2p | 3.1 MB | ######################################################################################################################################################################################################## | 100%
ca-certificates-2018 | 135 KB | ######################################################################################################################################################################################################## | 100%
certifi-2018.10.15 | 138 KB | ######################################################################################################################################################################################################## | 100%
gmp-6.1.2 | 676 KB | ######################################################################################################################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
看起来不错!
(envname) me@machine:~/plc/IHaskell$ stack install gtk2hs-buildtools
Linking /home/me/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 ...
/home/me/anaconda3/envs/envname/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
`x86_64-conda_cos6-linux-gnu-cc' failed in phase `Linker'. (Exit code: 1)
-- While building simple Setup.hs using:
/home/me/.stack/programs/x86_64-linux/ghc-8.4.4/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-2.2.0.1 /home/me/.stack/setup-exe-src/setup-mPHDZzAJ.hs /home/me/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /home/me/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4
Process exited with code: ExitFailure 1
该死,和以前一样的错误。
所以,从这里,你可以看到我已经安装了 gmp 包,实际上已经有一个更高的版本。问题似乎是链接器由于某种原因无法找到 gmp(即使它存在),因此重新安装 gmp 将无济于事。
更新 2
我尝试的另一件事是:
$ conda install gxx_linux-64
推荐这里,也没有用。
更新 3
这看起来也像同样的问题,以这种方式解决,但对我不起作用。