前言

前几天刚在Ubuntu 18.04下装完CppAD跟Ipopt 3.12.7,搞显卡驱动把整个电脑都搞崩了,现在换了Ubuntu 20.04。(以为N卡驱动可以没问题了,结果还是有问题。。)

这篇文章的主要内容,跟是啥Ubuntu系统没关系。
网上查到中文安装版本基本都是3.12.7的。发现3.13.2安装有点不太一样。

可以查看下之前那篇文章,先了解下大概。
https://blog.csdn.net/weixin_42268975/article/details/107708414

这回主要参考的是官方版安装教程

流程

对比3.12.7与3.13.2会发现,文件夹结构发生了变化
3.12.7中,专门的ThirdParty文件夹,另外还有include,lib文件夹;在3.12.2中就都没了。
所以,安装依赖的时候就晕了。还有其他的处理也就都不一样了。

1. Getting System Packages (Compilers, …)

sudo apt-get install gcc g++ gfortran git patch wget pkg-config liblapack-dev libmetis-dev

其中的liblapack-dev libmetis-dev后面会有需要

2. Download, build, and install dependencies

这里就准备根据3.12.7的ThirdParty来选装内容。

2.1 ASL (Ampl Solver Library)

git clone https://github.com/coin-or-tools/ThirdParty-ASL.git
cd ThirdParty-ASL
./get.ASL
./configure
make
sudo make install

2.2 BLAS and LAPACK

Ipopt’s build system tries to find an installation of BLAS and LAPACK in your system. On Ubuntu, such libraries can be made available by installing liblapack-dev.

liblapack-dev在前面已经安装好了

如果不安装liblapack-dev,在后面安装HSL,或者IPOPT的时候也会报缺少BLAS

2.3 HSL (Harwell Subroutines Library)

先申请HSL,Go to
然后

git clone https://github.com/coin-or-tools/ThirdParty-HSL.git
cd ThirdParty-HSL

将申请到的HSL解压,改名为coinhsl文件夹,放到ThirdParty-HSL
Now unpack the HSL sources archive, move and rename the resulting directory so that it becomes ThirdParty-HSL/coinhsl. Then, in ThirdParty-HSL, configure, build, and install the HSL sources:

./configure
make
sudo make install

另外有说到:

The linear solvers MA57, HSL_MA77, HSL_MA86, HSL_MA97 can make use of the matrix ordering algorithms implemented in METIS. ThirdParty-HSL will look automatically for a METIS installation in your system and should work with both METIS 4 and METIS 5.

我估计就是指前面说的libmetis-dev

2.4 MUMPS Linear Solver

git clone https://github.com/coin-or-tools/ThirdParty-Mumps.git
cd ThirdParty-Mumps
./get.Mumps
./configure
make
sudo make install

这里也说到:

MUMPS will perform better if the matrix ordering algorithms implemented in METIS are available on the system.

2.5 Pardiso与WSMP 没管

3. Getting the Ipopt Code

安装,解压,编译,都没啥问题
包括里面的make test各项都显示成功

configure完,If the last output line reads configure: Main configuration of Ipopt successful then everything worked fine.

还有就是

The default configure (without any options) is sufficient for most users that downloaded and installed the source code for the linear solver and other dependencies.

前面搞了BLAS and LAPACK 还有MUMPS Linear Solver ,里面说在configure时做一下参数设置。
我设置完会报错,然后干脆就不设置参数了。
(不懂,不明白,反正后面测试用例跑出来了。。)

4. 安装CppAD

sudo apt-get install cppad

5. 测试

示例1,示例2

6. 测试报错与解决

这个才是大坑!
因为之前别人的都是3.12.7,现在3.13.2文件结构都不一样了。

我这种对系统啥都不明白的人,真是太难了。报错:

/usr/include/cppad/ipopt/solve_callback.hpp:16:11: fatal error: coin/IpIpoptApplication.hpp: 没有那个文件或目录

解决:

cd /usr/local/include
sudo cp -r coin-or coin

就是把coin-or 文件夹改名成coin
因为查到在IpIpoptApplication.hppcoin-or其实是有的,猜估计是没认出coin-or,就另外复制一个重命名。结果搞定。

Ubuntu 20.04 安装CppAD 与 Ipopt 3.13.2避坑指南相关推荐

  1. ubuntu18.0.4 不能下载 libgd2-dev(ubuntu 20.04 安装perl 中GD 模块失败的解决办法)

    ubuntu18.0.4 不能下载 libgd2-dev 一.错误信息: Unable to locate package libgd2-dev 二.原因 没有对应源 到 https://packag ...

  2. Win10 和 Ubuntu 20.04 安装 face_recognition 和 dlib

    face_recognition是一个人脸识别库. WIN10安装: 首先改一下下载源: 1.C:\Users\xx\pip,新建文件pip.ini 2.文件里面输入: [global] index- ...

  3. Ubuntu 20.04安装Ros Noetic及Ubuntu 18.04安装ROS Melodic(两版本详细填坑)

    Ubuntu 20.04安装Ros Noetic及18.04安装ROS Melodic 表1-1 ROS的历史版本 1. 设置安装源 2. 添加秘钥 3. 更新列表 4. 开始安装 5. 配置ROS环 ...

  4. ubuntu 20.04安装各类软件

    ubuntu 20.04安装各类软件 一.前言 ubuntu 20.04安装后,我输入gcc -v,出现了下面的情况,差点裂开了,20.04居然没有自带gcc编译器,以前安装的版本12.04 16.0 ...

  5. ubuntu 20.04 安装 flameshot截图工具

    ubuntu 20.04 安装 flameshot截图工具 安装命令 使用命令 设置快捷键 效果图 安装命令 sudo apt-get install flameshot 安装日志 $ sudo ap ...

  6. ubuntu 20.04 安装软件踩坑

    ubuntu 20.04 安装软件踩坑 1.搜狗输入法 安装后需要重启一次 重启后讲sogoupinyin添加好,右上角如果没有搜狗就再重启一下 右上角出现了搜狗也是打不出中文的,因为没有安装依赖 安 ...

  7. Ubuntu 20.04安装CUDA失败导致系统黑屏消息nvidia 0000:01:00.0: can‘t change power state from D3cold to D0 的解决方法

    Ubuntu 20.04安装CUDA失败导致系统黑屏消息nvidia 0000:01:00.0: can't change power state from D3cold to D0 的解决方法 贺志 ...

  8. ubuntu 20.04 安装ibus-rime输入法

    ubuntu 20.04 安装ibus-rime输入法 为什么安装这个输入法 ibus-rime 安装 使用命令安装 基本设置 为什么安装这个输入法 没有安装搜狗输入法是因为安装完搜狗输入法之后再安装 ...

  9. ubuntu 20.04 安装 gedit

    @ubuntu 20.04 安装 gedit ubuntu 20.04 安装 gedit 打开终端 1.输入命令: sudo apt-get update 如下图所示 2.输入命令: sudo apt ...

最新文章

  1. fastJson结合Nutz.Mapl的进阶应用
  2. matplotlib 中将图直接从buffer中变为PIL 再到numpy
  3. 吴恩达 coursera ML 第十课总结+作业答案
  4. 05_pandas读写文件,读写数据到CSV,HDF5,Excel中
  5. mysql正则替换字符串_mysql中替换字符串(正则) 模糊
  6. Linux入门学习(二)
  7. Linux常用shell脚本
  8. 美国Appstore游戏数据分析
  9. PS--用法/快捷键
  10. 社交电商难定义,蘑菇街、小红书、拼多多注定要兵分三路?
  11. Deep Speech笔记
  12. 谈谈WebService开发-基础篇
  13. 为了探究妹纸对内衣的喜好,我爬了淘宝内衣店的数据!
  14. eclipse安装angularjs
  15. 严格模式和标准模式的区别(附严格模式实战实例)
  16. 通信原理 | FFT/STFT 你真的学会了吗?
  17. Scikit-learn机器学习实战之Kmeans
  18. 计算机视觉到底需要学什么?怎么快速入门?
  19. Fabric学习笔记——一、环境搭建(小白入门)
  20. 秘密共享(Secret Sharing,SS)

热门文章

  1. 电梯控制算法(7)多电梯场景——两个等价电梯——动态指派
  2. 论文阅读:GCRN:Learning Complex Spectral Mapping With GatedConvolutional Recurrent Networks forMonaural
  3. OA选型方法论之教育OA系统
  4. Day820.抢购活动性能瓶颈调优 -Java 性能调优实战
  5. MATLAB数值分析学习笔记:多项式拟合
  6. 搜索引擎优化SEO初探
  7. PXIEBPMCx4载板转接卡
  8. Nbtscan.exe工具分析
  9. axure rp 9 嵌套动态面板 拖动
  10. ubuntu下安装UltraEdit