gcc - ld 找不到 -l<库>

标签 gcc ubuntu linker shared-libraries ld

我在 ubuntu 12.04 上安装 pyipopt 时遇到问题。在链接期间,我收到错误:

/usr/bin/ld: cannot find -lcoinhsl

即使我知道这个库已经安装并且 .so 和 .la 文件在 /home/mostafa/MyBuilds/CoinIpopt/build/lib/

有人对此有解决方案吗?

下面是运行 setup.py build 的完整返回:

root@ubuntu:~/MyBuilds/pyipopt# sudo python setup.py build
running build
running build_ext
building 'pyipopt' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/pyipopt.c -o build/temp.linux-x86_64-2.7/src/pyipopt.o
src/pyipopt.c: In function ‘set_intermediate_callback’:
src/pyipopt.c:452:15: warning: variable ‘myowndata’ set but not used [-Wunused-but-set-variable]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relrobuild/temp.linux-x86_64-2.7/src/callback.o build/temp.linux-x86_64-2.7/src/pyipopt.o -L/home/mostafa/MyBuilds/CoinIpopt/build/lib/ -lipopt -lblas -lcoinhsl -lcoinmetis -llapack -ldl -lm -o build/lib.linux-x86_64-2.7/pyipopt.so -Wl,--rpath -Wl,/home/mostafa/MyBuilds/CoinIpopt/build/lib/
/usr/bin/ld: cannot find -lcoinhsl
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

最佳答案

-Ldir
Add directory dir to the list of directories to be searched for -l.

关于gcc - ld 找不到 -l<库>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12107422/

相关文章:

c - 在 GCC 中使用另一个汇编程序(MASM、NASM、TASM 等)

c - 为什么 sizeof ('3' ) == 4 使用 GCC 编译器?

shell - 如何在ubuntu中管道命令

ubuntu - 在 ubuntu 上的 erlang 中安装用于 ssl 的种子密码?

swift - vapor:地址已在使用中(错误号:98)

c++ - 包装 C++ 模板函数

android - 如何链接 cpufeatures lib 以获取 native android 库?

c - 为什么在使用 gcc C 将 uint32 转换为 uint8 时没有警告

c++ - 像 Rust 一样检测 UB

c++ - Boost iostreams 库存在,但我无法链接它