OpenModelica / OpenModelicaBuildScripts

Scripts to build OpenModelica packages on miscellaneous platforms
3 stars 9 forks source link

why does package omc depend on omplot? #27

Closed jdpipe closed 4 months ago

jdpipe commented 1 year ago

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 on omplot? 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 just build-essential, lsb-release and wget pre-installed.

Step 10/10 : RUN apt-get install -y omc omlibrary
 ---> Running in fdb7f168a0b6
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  adwaita-icon-theme aglfn at-spi2-core binfmt-support clang clang-14 dbus
  dbus-user-session dconf-gsettings-backend dconf-service dmsetup fontconfig
  fonts-droid-fallback fonts-liberation fonts-noto-mono fonts-urw-base35
  ghostscript gir1.2-glib-2.0 gnuplot-data gnuplot-nox groff groff-base
  gsettings-desktop-schemas gsfonts gtk-update-icon-cache hicolor-icon-theme
  humanity-icon-theme icu-devtools imagemagick imagemagick-6-common
  imagemagick-6.q16 lib32gcc-s1 lib32stdc++6 libaom3 libapparmor1 libargon2-1
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3
  libavahi-common-data libavahi-common3 libblas-dev libblas3 libboost-dev
  libboost-filesystem-dev libboost-filesystem1.74-dev
  libboost-filesystem1.74.0 libboost-program-options-dev
  libboost-program-options1.74-dev libboost-program-options1.74.0
  libboost-serialization-dev libboost-serialization1.74-dev
  libboost-serialization1.74.0 libboost-system-dev libboost-system1.74-dev
  libboost-system1.74.0 libboost1.74-dev libc6-i386 libcairo-gobject2
  libcairo2 libclang-common-14-dev libclang-cpp14 libclang1-14 libcolord2
  libcryptsetup12 libcups2 libcurl4 libdatrie1 libdav1d5 libdbus-1-3 libdconf1
  libde265-0 libdevmapper1.02.1 libdjvulibre-text libdjvulibre21 libdom4j-java
  libdouble-conversion3 libdrm-amdgpu1 libdrm-common libdrm-intel1
  libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 libegl-mesa0 libegl1 libelf1
  libepoxy0 libevdev2 libexpat1-dev libffi-dev libfftw3-double3 libfribidi0
  libgbm1 libgc1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin
  libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libgl1
  libgl1-amber-dri libgl1-mesa-dri libglapi-mesa libglib2.0-0 libglib2.0-data
  libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgs9 libgs9-common
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libharfbuzz0b
  libheif1 libice6 libicu-dev libicu70 libidn12 libijs-0.35 libilmbase25
  libinput-bin libinput10 libip4tc2 libjaxen-java libjbig2dec0 libjdom1-java
  libjson-c5 libjxr-tools libjxr0 libkmod2 liblapack-dev liblapack3 liblcms2-2
  libllvm13 libllvm14 liblqr-1-0 libltdl7 liblua5.4-0 libmagickcore-6.q16-6
  libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 libmd4c0 libmtdev1
  libncurses-dev libnetpbm10 libnghttp2-14 libnss-systemd libnuma1
  libobjc-11-dev libobjc4 libomc libomccpp libomcsimulation libomniorb4-2
  libomnithread4 libomp5-14 libomplot libopenexr25 libopenjp2-7 libpam-systemd
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils
  libpaper1 libpciaccess0 libpcre2-16-0 libpfm4 libpipeline1 libpixman-1-0
  libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5
  libqt5printsupport5 libqt5svg5 libqt5widgets5 librsvg2-2 librsvg2-common
  librtmp1 libsaxonb-java libsensors-config libsensors5 libsm6 libssh-4
  libthai-data libthai0 libtinfo-dev libuchardet0 libvulkan1 libwacom-bin
  libwacom-common libwacom9 libwayland-client0 libwayland-cursor0
  libwayland-egl1 libwayland-server0 libwebpdemux2 libwebpmux3
  libwmflite-0.2-7 libx11-xcb1 libx265-199 libxaw7 libxcb-dri2-0 libxcb-dri3-0
  libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0
  libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0
  libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xinput0
  libxcb-xkb1 libxcomposite1 libxcursor1 libxdamage1 libxerces2-java libxext6
  libxfixes3 libxi6 libxinerama1 libxkbcommon-x11-0 libxkbcommon0
  libxml-commons-external-java libxml-commons-resolver1.1-java libxml2
  libxml2-dev libxmu6 libxom-java libxrandr2 libxrender1 libxshmfence1
  libxslt1.1 libxt6 libxtst6 libxxf86vm1 libyaml-0-2 libz3-4 libz3-dev llvm-14
  llvm-14-dev llvm-14-linker-tools llvm-14-runtime llvm-14-tools
  mesa-vulkan-drivers netpbm networkd-dispatcher omc-common omplot
  poppler-data psutils python3-dbus python3-gi python3-pkg-resources
  python3-pygments python3-yaml qt5-gtk-platformtheme qttranslations5-l10n
  session-migration shared-mime-info systemd systemd-sysv systemd-timesyncd
  ubuntu-mono unzip x11-common xdg-user-dirs xkb-data xsltproc zip
Suggested packages:
  clang-14-doc fonts-noto fonts-freefont-otf | fonts-freefont-ttf
  fonts-texgyre ghostscript-x gnuplot-doc imagemagick-doc autotrace cups-bsd
  | lpr | lprng curl enscript ffmpeg gimp grads graphviz hp2xx html2ps
  libwmf-bin mplayer povray radiance sane-utils texlive-base-bin transfig
  ufraw-batch xdg-utils liblapack-doc libboost-doc libboost1.74-doc
  libboost-atomic1.74-dev libboost-chrono1.74-dev libboost-container1.74-dev
  libboost-context1.74-dev libboost-contract1.74-dev
  libboost-coroutine1.74-dev libboost-date-time1.74-dev
  libboost-exception1.74-dev libboost-fiber1.74-dev libboost-graph1.74-dev
  libboost-graph-parallel1.74-dev libboost-iostreams1.74-dev
  libboost-locale1.74-dev libboost-log1.74-dev libboost-math1.74-dev
  libboost-mpi1.74-dev libboost-mpi-python1.74-dev libboost-numpy1.74-dev
  libboost-python1.74-dev libboost-random1.74-dev libboost-regex1.74-dev
  libboost-stacktrace1.74-dev libboost-test1.74-dev libboost-thread1.74-dev
  libboost-timer1.74-dev libboost-type-erasure1.74-dev libboost-wave1.74-dev
  libboost1.74-tools-dev libmpfrc++-dev libntl-dev libboost-nowide1.74-dev
  colord cups-common libdom4j-java-doc libmsv-java libxpp2-java libxpp3-java
  libfftw3-bin libfftw3-dev gvfs icu-doc libjdom1-java-doc liblcms2-utils
  inkscape ncurses-doc pciutils qt5-image-formats-plugins qtwayland5
  librsvg2-bin libsaxonb-java-doc lm-sensors libxerces2-java-doc
  libxml-commons-resolver1.1-java-doc pkg-config libxom-java-doc llvm-14-doc
  iw | wireless-tools python-beautifulsoup poppler-utils fonts-japanese-mincho
  | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic
  fonts-arphic-ukai fonts-arphic-uming fonts-nanum python-dbus-doc
  python3-setuptools python-pygments-doc ttf-bitstream-vera systemd-container
  libfido2-1 libtss2-esys-3.0.2-0 libtss2-mu0 libtss2-rc0 policykit-1
The following NEW packages will be installed:
  adwaita-icon-theme aglfn at-spi2-core binfmt-support clang clang-14 dbus
  dbus-user-session dconf-gsettings-backend dconf-service dmsetup fontconfig
  fonts-droid-fallback fonts-liberation fonts-noto-mono fonts-urw-base35
  ghostscript gir1.2-glib-2.0 gnuplot-data gnuplot-nox groff groff-base
  gsettings-desktop-schemas gsfonts gtk-update-icon-cache hicolor-icon-theme
  humanity-icon-theme icu-devtools imagemagick imagemagick-6-common
  imagemagick-6.q16 lib32gcc-s1 lib32stdc++6 libaom3 libapparmor1 libargon2-1
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3
  libavahi-common-data libavahi-common3 libblas-dev libblas3 libboost-dev
  libboost-filesystem-dev libboost-filesystem1.74-dev
  libboost-filesystem1.74.0 libboost-program-options-dev
  libboost-program-options1.74-dev libboost-program-options1.74.0
  libboost-serialization-dev libboost-serialization1.74-dev
  libboost-serialization1.74.0 libboost-system-dev libboost-system1.74-dev
  libboost-system1.74.0 libboost1.74-dev libc6-i386 libcairo-gobject2
  libcairo2 libclang-common-14-dev libclang-cpp14 libclang1-14 libcolord2
  libcryptsetup12 libcups2 libcurl4 libdatrie1 libdav1d5 libdbus-1-3 libdconf1
  libde265-0 libdevmapper1.02.1 libdjvulibre-text libdjvulibre21 libdom4j-java
  libdouble-conversion3 libdrm-amdgpu1 libdrm-common libdrm-intel1
  libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 libegl-mesa0 libegl1 libelf1
  libepoxy0 libevdev2 libexpat1-dev libffi-dev libfftw3-double3 libfribidi0
  libgbm1 libgc1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin
  libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libgl1
  libgl1-amber-dri libgl1-mesa-dri libglapi-mesa libglib2.0-0 libglib2.0-data
  libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgs9 libgs9-common
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libharfbuzz0b
  libheif1 libice6 libicu-dev libicu70 libidn12 libijs-0.35 libilmbase25
  libinput-bin libinput10 libip4tc2 libjaxen-java libjbig2dec0 libjdom1-java
  libjson-c5 libjxr-tools libjxr0 libkmod2 liblapack-dev liblapack3 liblcms2-2
  libllvm13 libllvm14 liblqr-1-0 libltdl7 liblua5.4-0 libmagickcore-6.q16-6
  libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 libmd4c0 libmtdev1
  libncurses-dev libnetpbm10 libnghttp2-14 libnss-systemd libnuma1
  libobjc-11-dev libobjc4 libomc libomccpp libomcsimulation libomniorb4-2
  libomnithread4 libomp5-14 libomplot libopenexr25 libopenjp2-7 libpam-systemd
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils
  libpaper1 libpciaccess0 libpcre2-16-0 libpfm4 libpipeline1 libpixman-1-0
  libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5
  libqt5printsupport5 libqt5svg5 libqt5widgets5 librsvg2-2 librsvg2-common
  librtmp1 libsaxonb-java libsensors-config libsensors5 libsm6 libssh-4
  libthai-data libthai0 libtinfo-dev libuchardet0 libvulkan1 libwacom-bin
  libwacom-common libwacom9 libwayland-client0 libwayland-cursor0
  libwayland-egl1 libwayland-server0 libwebpdemux2 libwebpmux3
  libwmflite-0.2-7 libx11-xcb1 libx265-199 libxaw7 libxcb-dri2-0 libxcb-dri3-0
  libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0
  libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0
  libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xinput0
  libxcb-xkb1 libxcomposite1 libxcursor1 libxdamage1 libxerces2-java libxext6
  libxfixes3 libxi6 libxinerama1 libxkbcommon-x11-0 libxkbcommon0
  libxml-commons-external-java libxml-commons-resolver1.1-java libxml2
  libxml2-dev libxmu6 libxom-java libxrandr2 libxrender1 libxshmfence1
  libxslt1.1 libxt6 libxtst6 libxxf86vm1 libyaml-0-2 libz3-4 libz3-dev llvm-14
  llvm-14-dev llvm-14-linker-tools llvm-14-runtime llvm-14-tools
  mesa-vulkan-drivers netpbm networkd-dispatcher omc omc-common omlibrary
  omplot poppler-data psutils python3-dbus python3-gi python3-pkg-resources
  python3-pygments python3-yaml qt5-gtk-platformtheme qttranslations5-l10n
  session-migration shared-mime-info systemd systemd-sysv systemd-timesyncd
  ubuntu-mono unzip x11-common xdg-user-dirs xkb-data xsltproc zip
0 upgraded, 287 newly installed, 0 to remove and 0 not upgraded.
Need to get 331 MB of archives.

Here is the Dockerfile FYI

FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

# this is a package cache to reduce server load, see https://is.gd/WWOpmA
#RUN echo 'Acquire::http { Proxy "http://localhost:3142"; };' > /etc/apt/apt.conf.d/01proxy

RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install build-essential lsb-release wget

RUN echo "deb http://build.openmodelica.org/apt `lsb_release -cs` stable" | tee /etc/apt/sources.list.d/openmodelica.list
RUN wget -q http://build.openmodelica.org/apt/openmodelica.asc -O- | apt-key add -
RUN apt-get update
RUN apt-get install -y omc omlibrary
phannebohm commented 1 year 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.

jdpipe commented 1 year ago

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.

hkiel commented 1 year ago

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.

adrpo commented 4 months ago

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.