我在/usr/local/从源代码中构建了IPOPT,然后尝试为python python setup.py install安装ipopt。
但是,安装程序抱怨(错误)无法定位IpStdCInterface.h。
然后,我修改了setup.py文件的内容如下:(第1行和第3行有错误的路径)
IPOPT_ICLUDE_DIRS=['/usr/local/include/coin']
IPOPT_LIBS=['ipopt', 'coinhsl', 'coinlapack', 'coinblas', 'coinmumps', 'coinmetis']
IPOPT_LIB_DIRS=['/usr/local/lib/']
IPOPT_DLL=None我修改了第一行和第三行,以指向正确的目录。
现在,libipopt.so.0,目录路径(在上面的第三行)包含一个名为libipopt.so、 libipopt.la (同名、不同扩展名)的库文件。
安装程序现在没有抱怨IpStdCInterface.h,但是它无法找到lib
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/cyipopt.o -L/usr/local/lib/ -lipopt -lcoinhsl -lcoinlapack -lcoinblas -lcoinmumps -lcoinmetis -o build/lib.linux-x86_64-2.7/ipopt/cyipopt.so
/usr/bin/ld: cannot find -lcoinhsl
/usr/bin/ld: cannot find -lcoinlapack
/usr/bin/ld: cannot find -lcoinblas
/usr/bin/ld: cannot find -lcoinmumps
/usr/bin/ld: cannot find -lcoinmetis
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1这些库应该由libipopt.so文件提供吗?还是我需要安装其他的软件包?
发布于 2019-03-19 22:41:12
我和你有同样的问题。我的解决方案是在.bashrc中添加以下命令:
export IPOPT_HOME="/opt/CoinIpopt"
export PATH="${PATH}:${IPOPT_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${IPOPT_HOME}/lib"/opt/CoinIpopt是安装IpOpt的路径。
https://stackoverflow.com/questions/49988987
复制相似问题