Commit 2fa09e9e authored by Christian Kral's avatar Christian Kral
Browse files

Add version compatible with Ubuntu 18.04 (Mint 19)

parent 2827b4f6
# Original code taken from,
# modified by Christian Kral, https:/
# Version history
# 2019-08-22 Now works under Ubuntu 18.04 and Java 8
# 2017-03-02 Inital version for Ubuntu 16.04
# Set work directory variable, which may be replaced by ~/work or ~/tmp for
# most users. This directory shall be created before running this script.
export WORK=/work
# Local installation directory with read + write + exectue access of the current
# user. This directory shall be created before running this script.
export INSTALLDIR=~/bin
# Install required packages
sudo apt install -y g++
sudo apt install -y subversion
sudo apt install -y gfortran
sudo apt install -y ipython
sudo apt install -y cmake
sudo apt install -y swig
sudo apt install -y ant
sudo apt install -y openjdk-8-jdk
sudo apt install -y python-dev
sudo apt install -y python-numpy
sudo apt install -y python-scipy
sudo apt install -y python-matplotlib
sudo apt install -y cython
sudo apt install -y python-lxml
sudo apt install -y python-nose
sudo apt install -y python-jpype
sudo apt install -y zlib1g-dev
sudo apt install -y libboost-dev
sudo apt install -y jcc
# Install IPOPT
cd ${WORK}
# Remove directory from previous installation attempt
sudo rm -fr Ipopt-3.10.2
# Version to be installed see install PDF at
tar zxvf Ipopt-3.10.2.tgz
cd Ipopt-3.10.2/ThirdParty/Blas
sed -i 's/ftp/http/g' ./get.Blas
cd ../Lapack
sed -i 's/ftp/http/g' ./get.Lapack
cd ../Mumps
# Not (yet ?) requires
# sed -i 's/ftp/http/g' ./get.Mumps
cd ../Metis
# Not (yet ?) requires
# sed -i 's/ftp/http/g' ./get.Metis
cd ../../
mkdir build
cd build
# Remove previously installed ipopt
rm -fr ${INSTALLDIR}/ipopt
../configure --prefix=${INSTALLDIR}/ipopt
make install
# Create data variable
DATE=`date +%Y%m%d`
# Remove existing directory from work, if existing
sudo rm -fr ${WORK}/jmodelica
# Export data from jmodelica repository
svn export ${WORK}/jmodelica
cd ${WORK}/jmodelica
# Replace solver_object.output with solver_object.getOutput
# See
# find ./ -exec sed -i 's/solver_object.output/solver_object.getOutput/g' {} \;
find ./ -type f -exec sed -i -e 's/solver_object.output/solver_object.getOutput/g' {} \;
mkdir build
cd build
../configure --prefix=${INSTALLDIR}/jmodelica${DATE} --with-ipopt=${INSTALLDIR}/ipopt
export LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk-amd64/bin
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
export J2SDKDIR=/usr/lib/jvm/java-8-openjdk-amd64/
export J2REDIR=/usr/lib/jvm/java-8-openjdk-amd64/jre/
make install
make casadi_interface
echo "#!/bin/bash" >${INSTALLDIR}/jmodelica${DATE}.sh
echo "export WORK=${WORK}" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "cd ${WORK}" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "export MODELICAPATH=${WORK}:${INSTALLDIR}/jmodelica${DATE}/ThirdParty/MSL/" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "export J2SDKDIR=/usr/lib/jvm/java-8-openjdk-amd64/" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "export J2REDIR=/usr/lib/jvm/java-8-openjdk-amd64/jre/" >>${INSTALLDIR}/jmodelica${DATE}.sh
echo "${INSTALLDIR}/jmodelica${DATE}/bin/ --matplotlib" >>${INSTALLDIR}/jmodelica${DATE}.sh
chmod +x ${INSTALLDIR}/jmodelica${DATE}.sh
ln -s ${INSTALLDIR}/jmodelica${DATE}.sh ${INSTALLDIR}/
echo ""
echo "Installation completed"
echo "Start script is: ${INSTALLDIR}/"
echo "Being an alias of: ${INSTALLDIR}/jmodelica${DATE}.sh"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment