14

我正在尝试在运行 OS X 10.10 Yosemite 的 Mac 上编译 haskell 程序,但每次使用ld: library not found for -lgmp时 ghc 都会失败:

$ ghc foo.hs
[1 of 1] Compiling Main             ( foo.hs, foo.o )
Linking foo ...
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

帮助?

4

3 回答 3

33

我的系统上缺少的东西是来自 xcode 的最新命令行工具。安装最新版本并xcode-select --install修复问题。

于 2014-11-13T01:43:13.057 回答
3

我做到了brew uninstall ghc && brew install ghc,它修复了它(在优胜美地)。

于 2014-11-20T06:42:46.037 回答
1

这在 OSX (10.15) Catalina 上对我有用:

brew install pkg-config hidapi libev gmp
于 2021-07-19T20:00:23.567 回答