Compile OpenModelica and JModelica on Fedora 20
Theses compilation instructions were tested using a virtual machine running a basic Fedora 20 installation.
OpenModelica is more difficult to compile than JModelica due its larger code base and dependencies.
Common Part
First we must install a compilation environment and the scientific Python environment:
yum -y install gcc gcc-c++ gcc-gfortran
yum -y install java-1.7.0-openjdk ant
yum -y install autoconf automake libtool
yum -y install cmake
yum -y install patch
yum -y install subversion
yum -y install stow
yum -y install python python-devel
yum -y install python-virtualenv
yum -y install numpy scipy python-matplotlib python-ipython
We will create a stow directory in /usr/local so as to do not spoil our installation with our manually compiled software:
STOW=/usr/local/stow
mkdir $STOW # as root
chmod 777 $STOW # could simplify the life
Stow is a software package installation manager that help to manage the /usr/local directory, see man stow for the documentation.
We will also create a virtual environment for Python in order to install the modules which are not provided by Fedora:
cd /usr/local/stow # for example
virtualenv --system-site-packages modelica
source modelica/bin/activate
OpenModelica Installation
OpenModelica requires to install first SML/NG, RML/MMC and OmniORB.
SML/NJ
The installation instructions for SML/NJ are available here.
SML/NG is a 32-bit system thus we have to install some 32-bit packages:
yum -y install libgcc.i686 glibc-devel.i686
Define the installation directory:
SMLNJ_HOME=${STOW}/smlnj
Download and extract the archive:
mkdir ${SMLNJ_HOME}
cd ${SMLNJ_HOME}
SMLNJ_VERSION=110.74
wget http://smlnj.org/dist/working/${SMLNJ_VERSION}/config.tgz
gunzip <config.tgz | tar xf -
Run the install script:
./config/install.sh
The resulting installation is not clean but it works.
Set the PATH environment variable:
export PATH=${SMLNJ_HOME}/bin:$PATH
RML/MMC
Warning
Don't install mlton Fedora package else mllex fails.
Complete the compilation environment:
yum -y install bison flex
Define the installation directory:
RML_HOME=${STOW}/mmc
Checkout the source code from OpenModelica SVN:
svn co --username anonymous https://openmodelica.org/svn/MetaModelica/trunk mmc
Compile and install:
cd mmc
./configure --prefix=${RML_HOME}
make ; make install
Set the PATH environment variable:
export PATH=${RML_HOME}/bin:$PATH
OmniORB
Warning
For some reason the OmniORB package of Fedora doesn't provide the Python module.
Download the archives omniORB-4.1.7.tar.bz2 and omniORBpy-3.7.tar.bz2 here.
Extract the archives, compile and install:
tar xjf omniORB-4.1.7.tar.bz2
./configure --prefix=${STOW}/omniORB-4.1.7
make ; make install
tar xjf omniORBpy-3.7.tar.bz2
./configure --with-omniorb=${STOW}/omniORB-4.1.7 --prefix=${STOW}/omniORB-4.1.7
make ; make install
Set the PATH environment variable:
export PATH=${STOW}/omniORB-4.1.7/bin:$PATH
OpenModelica
Now we can install the OpenModelica dependencies which are provided by Fedora:
yum -y install boost-devel
yum -y install dbus-devel
yum -y install expat-devel
yum -y install readline-devel
yum -y install sqlite-devel
yum -y install qt-devel qtwebkit-devel qwt-devel
yum -y install gtkglext-devel
yum -y install OpenSceneGraph-qt-devel
yum -y install blas-devel lapack-devel
yum -y install lpsolve-devel
yum -y install opencl-headers sundials-devel # not required
Checkout the source code from OpenModelica SVN:
svn co https://openmodelica.org/svn/OpenModelica/trunk/ openmodelica
Compile and install:
cd openmodelica
autoconf
./configure --enable-omshell-terminal --enable-python-interface --with-omniORB --with-qwt --without-paradiseo --prefix=${STOW}/OpenModelica-1.9
make ; make install
I could not achieve to compile Paradiseo up to now.
Set the Python Path:
export PYTHONPATH=${STOW}/omniORB-4.1.7/lib/python2.7/site-packages:${STOW}/omniORB-4.1.7/lib64/python2.7/site-packages:$PYTHONPATH
export PYTHONPATH=${STOW}/OpenModelica-1.9/lib/python/:${STOW}/OpenModelica-1.9/lib/python2.7/site-packages:$PYTHONPATH
JModelica Installation
The installation instructions on Linux systems are available here.
Install some Python related packages:
yum -y install Cython
yum -y install python-lxml python-nose
yum -y install swig
Next we have two install two dependencies which are not available in Fedora: Ipopt and JPype.
Ipopt
IPopt requires wget to download some archives:
yum -y install wget
Download the archive and some dependencies:
curl -O http://www.coin-or.org/download/source/Ipopt/Ipopt-3.11.7.tgz
tar xzf Ipopt-3.11.7.tgz
cd Ipopt-3.11.7
cd ThirdParty
cd Blas ; ./get.Blas ; cd ..
cd ASL ; ./get.ASL ; cd ..
cd Mumps ; ./get.Mumps ; cd ..
cd Metis ; ./get.Metis ; cd ..
cd ..
Compile and install:
mkdir build
cd build
../configure --prefix=${STOW}/Ipopt-3.11.7
make ; make install
JPype
Download the JPype source code here and install the Python module:
unzip JPype-0.5.4.2.zip
cd JPype-0.5.4.2
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk
python setup.py install
JModelica
Checkout the source code from the JModelica SVN:
svn co https://svn.jmodelica.org/trunk JModelica.org
Compile and install:
cd JModelica.org
export CFLAGS="-fPIC ${CFLAGS}"
export CXXFLAGS="-fPIC ${CXXFLAGS}"
export FFLAGS="-fPIC ${FFLAGS}"
mkdir build
../configure --prefix=${STOW}/jmodelica-1.9 --with-ipopt=${STOW}/Ipopt-3.11.7
# /!\ check Python path
make ; make install
make install_casadi