【发布时间】:2015-06-19 16:11:39
【问题描述】:
我想在 Mac OS X 上安装第三方 C 库 (http://cgm.cs.mcgill.ca/~avis/C/lrs.html)。但是,二进制文件似乎无法在 Mac OS X (10.9.5) 上安装。该库适用于 Unix/Linux 平台。
以下是我在尝试安装 make 文件时遇到的几个错误示例。首先,这是开箱即用运行make all 时出现的错误(出于某种原因,运行make all64 没有任何作用):
ld: library not found for -lgmp
我通过/opt/local 中的MacPorts 安装了GMP 库(https://gmplib.org/)。但是,似乎找不到该库:
cc 2nash-GMP.o -L. -llrsgmp -L/opt/local/include -lgmp -o 2nash
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [2nash] Error 1
rm 2nash-GMP.o
我怎样才能绕过这一切并在 Mac 上安装?
我会提到,我打算在我编写的一些(Matlab)代码的函数中多次调用这个 C 库中的函数。我更喜欢任何潜在的解决方案来允许这一点。
更新 #1: 我已经做了以下事情:
- 在 makefile 中,将
LIBDIR从/usr/lib更改为/opt/local/lib - 在 makefile 中,将
INCLUDEDIR从/usr/include更改为/opt/local/include - 将
gmp.h文件从/opt/local/include复制到/usr/include - 在 makefile 中,将
RANLIB ?= /bin/true更改为RANLIB ?= /usr/bin/true
现在,当我运行 make all 时,我收到以下消息:
make: Nothing to be done for `all'.
应该采取哪些其他步骤?
【问题讨论】:
-
请注意:我希望您将(编译时间).h 文件放在 /opt/local/include(并使用 -I 编译开关)和(链接时间).a/ 中。 /opt/local/lib 中的 so 文件(使用 -L 链接开关)。我不想在 /any/place/include 中看到库...