I'm trying to install IHaskell in jupyter, directly from instructions here.
I ran the following.
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
I got this error on the 5th command above, the gtk2hs-buildtools
one:
(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
Some searching told me cannot find -lgmp
is solved by:
$ sudo apt-get install libgmp3-dev
I did this. This installed successfully, but
(envname) me@machine:~/plc/IHaskell$ stack install gtk2hs-buildtools
Still produces the same error. What's wrong and how do I fix it?
Update from scinart's suggestion
$ 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
Looks good!
(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
Darn, same error as before.
So, from this, you can see I had the gmp package installed, and in fact had had a higher version. The issue seems to be that gmp cannot be found by the linker for some reason (even though it is there), so reinstalling gmp will not help.
Update 2
Another thing I tried was:
$ conda install gxx_linux-64
recommended here, also didn't work.
Update 3
This also looked like the same issue, resolved that way, but did not work for me.