Closed jdpipe closed 4 months ago
Whether you use them or not, there are plot*
commands available in the Scripting API, so omc needs to be able to generate plots and it's using OMPlot for that.
Not sure if it would be possible to have a separate version of omc without plotting support. I guess that would mean more maintenance work and we have limited resources already.
I understand about limited resources. However this would be a really helpful decoupling for more robust testing and development in my view. Being able to build and test without all that graphical overhead seems like a clearly useful thing.
A suggestion would be to have a simple function that detects whether or not plotting support is available on the current machine. If so, proceed with the command; if not, return an error to the use (like: "you need to install omplot in order to use this command"). There must be a very limited number of entry points for plotting commands. Detecting plotting would be a matter of detecting a binary in the same folder as omc, perhaps?
Related point on the scripting API: we find its approach to returning error messages so unwieldy that we avoid using the whole thing where possible. Would be great if a better solution could be found there. It is impossible, AFAIK, to run a .mos
script via omc
and to know whether it succeeded or failed. It makes very difficult to use within the context of a larger pipeline.
I imagine there are already failure pathways here with plotting. For example, if I attempt to plot via an SSH connection where there is no X-Windows forwarding. It will fail with some low-level error about not being able to access the DISPLAY:0.0 or somesuch.
Another option would be to make omplot also create gnuplot graphics. So, you can build either minimal omplot with only gnuplot output or another with full gui support.
I guess one can install the minimal stuff as we do in the docker image: https://github.com/OpenModelica/OpenModelicaDockerImages/blob/v1.22.3/Dockerfile#L12 as far as I know this will not install OMPlot or any GUI clients.
In our command-line-only use of OMC, it would be convenient to have as a light an installation process as possible.
I wonder why it is that the
omc
package in Debian/Ubuntu systems has been set to be dependent onomplot
? This seems to lead to a lot of dependencies being added that we don't need, things to do with gnuplot and qt5 and fonts and so on.Example output from a Dockerfile that uses an Ubuntu 22.04 image, and attempts to install OM 1.20.0,
sudo apt-get install omc omlibrary
on an updated system with justbuild-essential
,lsb-release
andwget
pre-installed.Here is the Dockerfile FYI