本安装教程在arm架构上进行测试,在x86的系统上也可以
1 下载
官方github:https://github.com/coin-or/Ipopt,但官方的ipopt包里面第三方库可能只有一个目录,这里将ipopt-3.12整个包打包好了,百度网盘永久免费链接如下:
链接:https://pan.baidu.com/s/1WLjxEKEgVUleiPU1ZHHwnQ 提取码:bite
![image.png](https://upload-images.jianshu.io/upload_images/27814278-1f6be06d7db813be.png?imageMogr2/auto-
orient/strip%7CimageView2/2/w/1240)
安装依赖:
sudo apt-get install libblas3 libblas-dev liblapack3 liblapack-dev gfortran build-essential cppad gcc g++
2 编译安装
cd Ipopt-3.12 #进入这个文件夹
mkdir build
cd build
../configure --prefix /usr/local --build=arm-linux #配置安装为arm架构的
#../configure --prefix /usr/local #配置安装为x86架构的
make -j4 #j后面的4是多少个核即cpu的核数
make test
sudo make install
安装成功如下图所示
配置库:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
sudo ldconfig
3 测试安装是否成功
ldconfig -p | grep libipopt
meng@meng:~$ ldconfig -p | grep libipopt
libipoptamplinterface.so.0 (libc6,AArch64) => /usr/local/lib/libipoptamplinterface.so.0
libipoptamplinterface.so (libc6,AArch64) => /usr/local/lib/libipoptamplinterface.so
libipopt.so.0 (libc6,AArch64) => /usr/local/lib/libipopt.so.0
libipopt.so (libc6,AArch64) => /usr/local/lib/libipopt.so
成功的话如下所示:
4 报错
4.1 /Ipopt-3.12.4/ThirdParty/ASL/install-sh: Permission denied
make -j4后出现如下报错,是权限问题;在安装包对应文件下赋予权限即可
meng@meng:~/Desktop/softwares/gxj/Ipopt-3.12.4/build$ make -j8
Making all in ThirdParty/ASL
make[1]: Entering directory '/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/build/ThirdParty/ASL'
./compile_Unix_ASL
./compile_Unix_ASL: 24: ./compile_Unix_ASL: /home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/ThirdParty/ASL/install-sh: Permission denied
Makefile:724: recipe for target 'libamplsolver.a' failed
make[1]: *** [libamplsolver.a] Error 126
make[1]: Leaving directory '/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/build/ThirdParty/ASL'
Makefile:323: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
sudo chmod 777 install-sh
4.2 安装报错
sudo make install后报如下错误,这里把ipopt整个包舍弃,换成1中百度网盘中的包,就编译过了。
/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/Ipopt/install-sh -c -m 644 config_ipopt.h /usr/local/include/coin/IpoptConfig.h
/bin/bash: /home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/Ipopt/install-sh: Permission denied
Makefile:718: recipe for target 'install-exec-local' failed
make[3]: *** [install-exec-local] Error 126
make[3]: Leaving directory '/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/build/Ipopt/src/Common'
Makefile:631: recipe for target 'install-am' failed
make[2]: *** [install-am] Error 2
make[2]: Leaving directory '/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/build/Ipopt/src/Common'
Makefile:677: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/bit/Desktop/softwares/gxj/Ipopt-3.12.4/build/Ipopt'
Makefile:323: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
————————————————
版权声明:本文为CSDN博主「biter0088」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/BIT_HXZ/article/details/124104568