- Index
- » Users
- » randy.heydon
- » Profile
Posts
Posts
A while ago, I tried to package OpenModelica for Arch Linux and failed to get anything running. Now, I've finally managed to run OM on Arch by actually running it in Debian. If you're not familiar, a chroot (or the modernized equivalent, systemd-nspawn) lets you run a separate userspace (ie: OS) atop your already-running kernel. It's like a step shy of full virtualization. Here's how I got it to work.
Setting up goes something like this:
Code:
# Install debootstrap, the tool for creating Debian root images.
yaourt -S debootstrap
# Create a minimal Debian root.
mkdir ~/debian-root
sudo debootstrap --arch=amd64 --variant=minbase sid ~/debian-root # This will take a while.
cd ~/debian-root
# Download the OpenModelica Debian repository key for later.
sudo wget http://build.openmodelica.org/apt/openmodelica.asc
# Activate the container.
# This can also be done with the "chroot" command, but needs more pre-setup. Much information is already on the internet.
sudo systemd-nspawn
# You are now root in a Debian environment, but it needs to be configured.
# Add the OpenModelica package repository and key.
echo "deb http://build.openmodelica.org/apt nightly contrib" > /etc/apt/sources.list.d/openmodelica.list
apt-key add /openmodelica.asc && rm /openmodelica.asc
# Update all package lists.
apt-get update
# Install OpenModelica and xauth.
apt-get install openmodelica xauth # This will also take a while.
# Create a user account (omc refuses to run as root).
useradd a
Now that the Debian container is ready, the OpenModelica applications can be run inside it. But it takes some tricks to make them properly connect to your graphical (X) session. This does the trick for me, but it might be possible to improve it:
Code:
# Open your X session to the container.
xhost +
# Enter the container as user "a".
sudo systemd-nspawn -D ~/debian-root -u a
# Now inside the container, authenticate with the outside X session.
xauth generate :0 .
# And launch the OpenModelica connection editor.
DISPLAY=:0 OMEdit
I've wrapped up the launching code in a single script, OM, that allows me to launch any OpenModelica application as eg. "OM Edit" or "OM Plot". It requires you to enter your sudo password, but that can be worked around by editing sudoers (which is beyond the scope of this post).
Code:
#!/bin/sh
xhost +
sudo systemd-nspawn -D ~/debian-root -u a sh -c "/usr/bin/xauth generate $DISPLAY .; DISPLAY=$DISPLAY /usr/bin/OM$1"
xhost -
I hope that's helpful to someone. If there are any additions or corrections you have, let me know.
That's good, thanks. I had wanted to try that before, but I couldn't even get MLton installed. Go figure.
I modified the configure line of my PKGBUILD as per sjoelund's suggestion (ie: changed prefix to "/opt/openmodelica" and added "--disable-python-interface"), since they're otherwise effectively the same. Yet it still fails.
But the binary package is currently working for me, so I'm not personally in a rush to distribute a good PKGBUILD. But it would eventually be helpful for other Arch users.
My java was from openjdk6, but I replaced it with jre7-openjdk to match your version string. It looks like it's now getting past the ANTLR stuff, but fails at:
Code:
rm -f libomcruntime.a
ar -s -r libomcruntime.a Error_omc.o Print_omc.o System_omc.o Settings_omc.o IOStreamExt_omc.o ErrorMessage.o FMI_rml.o systemimplmisc.o UnitParserExt_omc.o unitparser.o BackendDAEEXT_omc.o Socket_omc.o matching.o matching_cheap.o Database_omc.o Dynload_omc.o SimulationResults_omc.o ptolemyio_omc.o Lapack_omc.o omc_communication.o omc_communication_impl.o Corba_omc.o
ar: creating libomcruntime.a
cp libomcruntime.a ../../build/lib/omc/
make[4]: Leaving directory `/home/randy/aur/openmodelica-svn/src/trunk/Compiler/runtime'
make[3]: Leaving directory `/home/randy/aur/openmodelica-svn/src/trunk/Compiler/omc_release'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/randy/aur/openmodelica-svn/src/trunk/Compiler/omc_release'
make[1]: *** [omc_release] Error 2
make[1]: Leaving directory `/home/randy/aur/openmodelica-svn/src/trunk/Compiler'
make: *** [omc] Error 2
I can't even see what's causing the error in there.
I have set up the PKGBUILD to run "make distclean" between each build, because it otherwise fails very early on. And I don't know enough about java to understand what you mean about having an ANTLR2 jar-file in my CLASSPATH. But I do appreciate the help.
I'm trying to compile and run OpenModelica on Arch Linux and, in the process, create PKGBUILDs for it (if you're not familiar, PKGBUILDs are shell scripts that get used to automatically compile and package software for Arch). There is an existing OpenModelica package, but it's three years out-of-date. And it depends on an RML package that's equally out-of-date. So I'm having a go at making it work.
I successfully created an RML package, built from the latest Subversion source. I then tried to create an OpenModelica package, but several hours of compiling resulted in a confusing error. But even if it worked, it fails early unless I start with a "make distclean". And I still don't know what software is needed to build it versus what is needed to run it, as the instructions are unclear on the distinction.
Eventually, I gave up and created a PKGBUILD that simply packages the pre-compiled binaries. It runs, but having to create symlinks for external libraries probably limits its public utility. Not to mention that I'm still unsure of all its dependencies.
If anyone can offer advice on getting this running, I would be very grateful.
- Index
- » Users
- » randy.heydon
- » Profile