Clang error while installing QuickCheck for GHC 7.8.3 on OS X Yosemite 10.10 (14A389)

烈酒焚心 提交于 2019-12-23 11:59:03

问题


While installing the QuickCheck for Haskell GHC 7.8.3 on a OS X Yosemite 10.10 (14A389) system running on a Mac Pro 2013 with Xcode 6.1 (6A1052d), I'm running into the following clang error:

   $ cabal install QuickCheck
Resolving dependencies...
Configuring primitive-0.5.4.0...
Building primitive-0.5.4.0...
Preprocessing library primitive-0.5.4.0...
[ 1 of 10] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/build/Data/Primitive/Internal/Compat.o )
[ 2 of 10] Compiling Data.Primitive.MachDeps ( Data/Primitive/MachDeps.hs, dist/build/Data/Primitive/MachDeps.o )
[ 3 of 10] Compiling Data.Primitive.Internal.Operations ( Data/Primitive/Internal/Operations.hs, dist/build/Data/Primitive/Internal/Operations.o )
[ 4 of 10] Compiling Control.Monad.Primitive ( Control/Monad/Primitive.hs, dist/build/Control/Monad/Primitive.o )
[ 5 of 10] Compiling Data.Primitive.Types ( Data/Primitive/Types.hs, dist/build/Data/Primitive/Types.o )
[ 6 of 10] Compiling Data.Primitive.Array ( Data/Primitive/Array.hs, dist/build/Data/Primitive/Array.o )

Data/Primitive/Array.hs:32:1: Warning:
    The import of ‘Control.Monad.ST’ is redundant
      except perhaps to import instances from ‘Control.Monad.ST’
    To import instances alone, use: import Control.Monad.ST()
[ 7 of 10] Compiling Data.Primitive.ByteArray ( Data/Primitive/ByteArray.hs, dist/build/Data/Primitive/ByteArray.o )
[ 8 of 10] Compiling Data.Primitive.Addr ( Data/Primitive/Addr.hs, dist/build/Data/Primitive/Addr.o )
[ 9 of 10] Compiling Data.Primitive   ( Data/Primitive.hs, dist/build/Data/Primitive.o )
[10 of 10] Compiling Data.Primitive.MutVar ( Data/Primitive/MutVar.hs, dist/build/Data/Primitive/MutVar.o )
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Failed to install primitive-0.5.4.0
Configuring random-1.1...
Building random-1.1...
Preprocessing library random-1.1...
[1 of 1] Compiling System.Random    ( System/Random.hs, dist/build/System/Random.o )
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Failed to install random-1.1
cabal: Error: some packages failed to install:
QuickCheck-2.7.6 depends on random-1.1 which failed to install.
primitive-0.5.4.0 failed during the building phase. The exception was:
ExitFailure 1
random-1.1 failed during the building phase. The exception was:
ExitFailure 1
tf-random-0.5 depends on random-1.1 which failed to install.

It seems that the dynamic library gmp is missing. Does somebody have found a solution to this problem?


回答1:


As @MichealFox said in his comment, installing command line tools resolves this issue.

xcode-select --install

It also resolves problems with many other cabal packages depending on gmp/lgmp library.




回答2:


I had the same issue (in my case compiling pandoc on a Centos 7 machine).

The gmp RPM was installed but not the gmp-devel RPM (which contains headers, linkable libraries, etc). This fixed it:

yum install gmp-devel


来源:https://stackoverflow.com/questions/26551245/clang-error-while-installing-quickcheck-for-ghc-7-8-3-on-os-x-yosemite-10-10-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!