Fix Visicut calling inkscape in an AppImage.
In Ubuntu 20.04, this worked flawlessly. But only by chance. We use libraries from the host system, together with the binary inside the mounted appimage. in Ubintu 22.04, this crashes:
/tmp/.mount_inkscaYGPL8G/usr/bin/inkscape --version /tmp/.mount_inkscaYGPL8G/usr/bin/inkscape: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory
The fix is to not call the binary directly, but the AppRun script, which nicely prepares the environment. But then, AppRun also prints a message for the user to stdout, (instead of stderr). We now need to filter this, when parsing output from e.g. --version:
/tmp/.mount_inkscaYGPL8G/AppRun --version 2>/dev/null You should not use AppImage in production, but you can speedup the AppImage by following this guide: https://inkscape.org/learn/appimage/ Inkscape 1.3.2 (091e20e, 2023-11-25)
This PR obsoletes https://wiki.fablab-nuernberg.de/index.php?title=VisiCut&action=edit§ion=2
I'll open a separate PR to fix the issues in the linux-checkinstall CI.
Fix for the CI problems available in https://github.com/t-oster/VisiCut/pull/722.
Please also report the stdout pollution as an upstream issue with Inkscape. We are probably not the only one affected by that.
( Side topics, not really relevant to this PR: What about the other combinations and directions - does calling Visicut from the AppImage Inkscape work correctly, even with all the AppImage environment variables? What if VisiCut is also an AppImage? )
If someone opens an issue upstream, please ask them to just export INKSCAPE_VERSION=1234 for plugins.
https://gitlab.com/inkscape/inbox/-/issues/10199
( Side topics, not really relevant to this PR: What about the other combinations and directions - does calling Visicut from the AppImage Inkscape work correctly, ...
Yes, I believe most real-life combinations work. I have especially tested the case where both, Inkscape and VisiCut are AppImages.
does calling Visicut from the AppImage Inkscape work correctly, ...
This is broken currently and will be working once this has been merged.
What does "found" mean? Is that an officially supported environment variable provided by the Inkscape code? Is it an AppImage-specific feature?
For Inkscape 1.3.x and 1.4.x (current / upcoming release), the AppImage sets INKSCAPE_COMMAND.
https://gitlab.com/inkscape/inkscape/-/blob/1.4.x/packaging/appimage/AppRun?ref_type=heads#L40-44
This was added in 2022: https://gitlab.com/inkscape/inkscape/-/merge_requests/4751
For Inkscape 1.5.x (development branch) the AppImage is currently broken and fails to launch Python, so it is not possible to test. https://gitlab.com/inkscape/inkscape/-/issues/4851
Inkscape's inkex library for writing extensions has been using it since at least 1.0, so I guess that the normal Inkscape installation >= 1.0 also sets the variable.
https://gitlab.com/inkscape/extensions/-/blob/master/inkex/command.py?ref_type=heads#L46
Once we drop support for AppImage-Inkscape < 1.3 and normal Inkscape < 1.0 (used e.g. on Ubuntu 20.04) we could throw out half of our extension code and instead use inkex.command and friends. Until then, I suggest to do it as above: Use INKSCAPE_COMMAND if available, else fall back to what we did before.