This guide should help you to install CasADi with IPOPT and HSL support.
- Install some dependencies
sudo apt-get install build-essential gfortran liblapack-dev libmetis-dev libopenblas-dev
and remove the ipopt installed with apt to avoid conflicts with the one that you will installsudo apt-get remove coinor-libipopt-dev
mkdir -p ~/robot-code/CoinIpopt && cd ~/robot-code/CoinIpopt
- Get
coinbrew
wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
chmod u+x coinbrew
- Run
./coinbrew Ipopt
and follow the instruction to fetch IPOPT and all the dependencies mkdir install
- Build ipopt
./coinbrew build Ipopt --prefix=install --test --no-prompt --verbosity=3
(have a ☕) - Obtain an archive with HSL source code from http://www.hsl.rl.ac.uk/ipopt/. (That for example is named
coinhsl-YYYY.MM.DD
) - Unzip the folder
coinhsl-YYYY.MM.DD.zip
into~/robot-code/CoinIpopt/ThirdParty/HSL/
and rename itcoinhsl
. cd ~/robot-code/CoinIpopt
- Build ipopt
./coinbrew build Ipopt --prefix=install --test --no-prompt --verbosity=3
(have a ☕) - Run
./coinbrew install Ipopt --no-prompt
- cd
~/robot-code/CoinIpopt/install/lib
ln -s libcoinhsl.so libhsl.so
- Add to the
.bashrc
the following linesexport IPOPT_DIR=~/robot-code/CoinIpopt/install export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${IPOPT_DIR}/lib/pkgconfig export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${IPOPT_DIR}/lib # ipopt this is required for casadi export PATH=${PATH}:${IPOPT_DIR}/lib # this may speed up ipopt export OMP_NUM_THREADS=1
- Clone CasADi
cd ~/robot-code && git clone https://github.com/casadi/casadi.git
mkdir -p casadi/build && cd casadi/build
- Run
cmake -DWITH_IPOPT:BOOL=ON -DWITH_HSL:BOOL=ON -DINCLUDE_PREFIX:PATH=include -DCMAKE_PREFIX:PATH=lib/cmake/casadi -DLIB_PREFIX:PATH=lib -DBIN_PREFIX:PATH=bin ..
make
andmake install
- Enjoy CasADi with IPOPT and HSL solvers 🚀