I'd like to install a third-party C library ( http://cgm.cs.mcgill.ca/~avis/C/lrs.html ) on a Mac OS X. However, the binaries won't seem to install on a Mac OS X (10.9.5). The library is intended for Unix/Linux platforms.
Here are a couple example of errors I get when trying to install the make
file. First, here's the error when running make all
out of the box (for some reason, running make all64
does nothing):
ld: library not found for -lgmp
I installed the GMP library ( https://gmplib.org/ ) via MacPorts in /opt/local
. However, the library does not appear to be found:
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
How can I get around all this and install on a Mac?
I'll mention that I intend to call a function from this C library many, many times within functions from some (Matlab) code I've written. I'd prefer any potential solution to allow for this.
Update #1: I've since done the following:
LIBDIR
from /usr/lib
to /opt/local/lib
INCLUDEDIR
from /usr/include
to /opt/local/include
gmp.h
file from /opt/local/include
to /usr/include
RANLIB ?= /bin/true
to RANLIB ?= /usr/bin/true
Now, when I run make all
, I get the following message:
make: Nothing to be done for `all'.
What other steps should be taken?
I think you would, instead, want something like:
cc 2nash-GMP.o -L. -llrsgmp -I/opt/local/include -L/opt/local/lib -lgmp -o 2nash
The -I
option specifies a path to headers to include. The -L
option specifies a path to library files to include.
将 makefile 中的变量LIBDIR
更改为安装库的位置,例如:
LIBDIR = /opt/local/lib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.