Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Build Old Version on New Linux Distro

Build Old Version on New Linux Distro

As I understand the installation guide for building from sources, it is for building the current version of OpenModelica on an older distro. I have the reverse problem: building an old version (1.14.1) on a new version of Linux: Mint 20. This is my first foray into building a package from sources on a Linux system; so I'm not sure what to modify in the "Downloading source code from repository" section to get this to work.

If this is possible, might someone point out what I need to do differently to build 1.14.1 (or 2) on a new Linux distro? If instead there is a website out there to help a newbie, that would be much appreciated as well. Some internet searching gets one into the weeds fast on building packages from source. current/smile It seems like the OpenModelica repos have all the pieces to correctly configure the sources. I just don't know how.

Edited by: vturnerbrc - Apr-02-21 14:25:19

Re: Build Old Version on New Linux Distro

Why do you need 1.14.x? 1.17.0 is way better current/smile

First you need to install git:
https://linuxhint.com/install-git-linux-mint/

Then you need to install the OpenModelica dependencies

Code:


for deb in deb deb-src; do echo "$deb http://build.openmodelica.org/apt `lsb_release -cs` nightly"; done | sudo tee /etc/apt/sources.list.d/openmodelica.list
wget -q http://build.openmodelica.org/apt/openmodelica.asc -O- | sudo apt-key add -
sudo apt update
sudo apt build-dep openmodelica

Then you need to clone the OpenModelica repository and checkout that specific version:

Code:


cd ~
git clone https://github.com/OpenModelica/OpenModelica.git --recursive
cd OpenModelica
git checkout v1.14.2
git submodule update --force --init --recursive

Then you configure OpenModelica

Code:


cd ~/OpenModelica
autoconf
./configure

Then you build the compiler and OMEdit:

Code:


cd ~/OpenModelica
# where NN is the number of cores your computer has
# if you have 4 cores write -j4 below
make -jNN

If all is fine you should have OpenModelica omc and OMEdit compiler in: ~/OpenModelica/build/
"~" is your home directory.

Then you need to install some Modelica libraries:

Code:


for PKG in `apt-cache search "omlib-.*" | cut -d" " -f1`; do sudo apt-get install -y "$PKG"; done

Then just start OMEdit in the terminal via:

Code:


~/OpenModelica/build/bin/OMEdit

Edited by: adrpo - Apr-02-21 14:48:42

Re: Build Old Version on New Linux Distro

Thanks for the directions!

It seems I am missing something from SUNDIALS when I build with make:


In file included from ./simulation/solver/kinsolSolver.c:70:
OpenModelicaBuild/OpenModelica/build/include/omc/c/sundials/kinsol/kinsol_klu.h:25:10: fatal error: kinsol/kinsol_sparse.h: No such file or directory
   25 | #include "kinsol/kinsol_sparse.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile.common:225: build/c/./simulation/solver/kinsolSolver.o] Error 1
make[3]: *** Waiting for unfinished jobs....
./simulation/solver/ida_solver.c:84:10: fatal error: idas/idas_klu.h: No such file or directory
   84 | #include <idas/idas_klu.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.





I did go and manually install libsundials-kinsol3. I see the Download directions say to install kinsol1.

I'm needing to build 1.14 since we were having issues with OMEdit in 1.16 specifically in regard to the fluid library. OMEdit 1.16 was unstable on Linux Mint and the fluid library did not help.

Edited by: vturnerbrc - Apr-02-21 15:37:49

Re: Build Old Version on New Linux Distro

By the way, the configure step didn't give errors.

Re: Build Old Version on New Linux Distro

Ok, I need some more info.

Code:


# clean third party
cd ~/OpenModelica/OMCompiler/3rdParty
git clean -fdx
# build with trace
cd ~/OpenModelica/
make -j4 > trace.txt 2>&1

Then paste here the trace.txt.
kinsol is build from source in 3rdParty: OMCompiler\3rdParty\sundials
As far as I can tell sundials can't detect SuiteSparse build but I need the trace.txt to see exactly what the issue is.

Re: Build Old Version on New Linux Distro

Don't bother, I tried building this myself on Linux Mint 20.1 and found and issue. SuiteSparse has issues when linking, is missing -lm.

Please take the attached patch and patch the SuiteSparse cmake files.
SuiteSparse.zip
Download and unzip the SuiteSparse.patch and place it in OpenModelica/OMCompiler/3rdParty

Code:


cd ~/OpenModelica/OMCompiler/3rdParty
# patch SuiteSparse
patch < SuiteSparse.patch
# clean 3rdParty
git clean -fdx
# return to top OpenModelica directory
cd ~/OpenModelica/
make -j4

Let me know if this works.


Attachments:

Re: Build Old Version on New Linux Distro

Thank-you for looking into this. I will try this out once the dust settles here. Working toward a deadline.

Re: Build Old Version on New Linux Distro

Thank-you again for the help. Was able to build in a fresh VM with your patch and then copy out to my host. Something funny about building on the host.

There are 0 guests and 0 other users also viewing this topic
You are here: