我在Ubuntu 12.04上安装pyipopt时遇到问题。在链接期间,我收到错误消息:
/ usr / bin / ld:找不到-lcoinhsl
即使我知道已经安装了该库,并且.so和.la文件在/home/mostafa/MyBuilds/CoinIpopt/build/lib/
中可用
有人对此有解决方案吗?
以下是运行setup.py build的完整返回:
root @ ubuntu:〜/ MyBuilds / pyipopt#sudo python setup.py构建
运行构建
运行build_ext
构建'pyipopt'扩展
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:在“ set_intermediate_callback”函数中:
src / pyipopt.c:452:15:警告:已设置变量“ myowndata”但未使用[-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:找不到-lcoinhsl
collect2:ld返回1退出状态
错误:命令“ gcc”失败,退出状态为1
最佳答案
-Ldir
将目录dir添加到要搜索-l的目录列表中。
关于gcc - ld找不到-l <library>,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12107422/