Skip to content

Instantly share code, notes, and snippets.

@yuzhangbit
Created October 30, 2017 08:38
Show Gist options
  • Save yuzhangbit/e296123c8070d02631baba8f9d05c411 to your computer and use it in GitHub Desktop.
Save yuzhangbit/e296123c8070d02631baba8f9d05c411 to your computer and use it in GitHub Desktop.
ipopt-3.12.4 install script.
#!/bin/bash
set -e # exit on first error
SOURCE_DIR="/tmp"
install_ipopt()
{
echo "Prepare to install IPOPT ..."
IPOPT_URL="https://git.coding.net/aRagdoll/Ipopt-3.12.4.git"
sudo apt-get -y install gfortran
if ( ldconfig -p | grep libipopt ); then
echo "Ipopt is already installed......."
else
echo "Start installing Ipopt, version: 3.12.4 .........."
cd $SOURCE_DIR
rm -rf Ipopt-3.12.4 && git clone "$IPOPT_URL" && cd Ipopt-3.12.4
# configure,build and install the IPOPT
echo "Configuring and building IPOPT ..."
./configure --prefix /usr/local
make -j$(nproc)
make test
sudo make install
if (grep 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' $HOME/.bashrc); then
echo "LD_LIBRARY_PATH has been set."
else
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> $HOME/.bashrc
fi
sudo ldconfig
echo "IPOPT installed successfully"
source $HOME/.bashrc
fi
}
install_ipopt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment