cabal报告"/ usr/bin/ld:找不到-lHSrandom-1.0.1.1-ghc7.8.3"

Kao*_*oet 8 haskell ld cabal

我有Ubuntu 14.04LTS.我ghc-7.8.3http://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux下载了最新版本并将其安装到/usr/local.

然后我更新了我cabal的版本1.20.0.3.

我输入cabal install QuickCheck了我的终端,得到了:

Resolving dependencies...
Configuring tf-random-0.5...
Building tf-random-0.5...
Preprocessing library tf-random-0.5...
[1 of 4] Compiling System.Random.TF.Gen ( src/System/Random/TF/Gen.hs, dist/build/System/Random/TF/Gen.o )
[2 of 4] Compiling System.Random.TF.Init ( src/System/Random/TF/Init.hs, dist/build/System/Random/TF/Init.o )

src/System/Random/TF/Init.hs:94:5: Warning:
    In the use of ‘bitSize’ (imported from Data.Bits):
    Deprecated: "Use 'bitSizeMaybe' or 'finiteBitSize' instead"
[3 of 4] Compiling System.Random.TF.Instances ( src/System/Random/TF/Instances.hs, dist/build/System/Random/TF/Instances.o )
[4 of 4] Compiling System.Random.TF ( src/System/Random/TF.hs, dist/build/System/Random/TF.o )
/usr/bin/ld: cannot find -lHSrandom-1.0.1.1-ghc7.8.3
collect2: error: ld returned 1 exit status
Failed to install tf-random-0.5
cabal: Error: some packages failed to install:
QuickCheck-2.7.5 depends on tf-random-0.5 which failed to install.
tf-random-0.5 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我已经haskell-platformghc-7.6.3通过安装apt-get前.

lef*_*out 12

我记得在设置ghc-7.8时有类似的问题.它与新的cabal有关,它与安装了旧版本的库不兼容(但它没有给出正确的问题原因.

无论如何,我认为重新安装有问题的软件包

cabal install random --reinstall --force-reinstalls 
Run Code Online (Sandbox Code Playgroud)

设置它cabal install tf-random然后应该成功.

  • 这也可以修复其他库的类似错误.如果你看到`/ usr/bin/ld:找不到-lHSfoobar-1.0.1.1-ghc7.8.3`那么你需要`cabal install foobar -reinstall --force-reinstalls`.您可能需要指定特定版本. (3认同)