Ticket #4343 - OPENSCAD not working with AppImage distros
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
4343 is still with us as of build 25943 (October 10, 2021) on freshly-updated Debian Testing.
Emptying LD_LIBRARY_PATH does not help.
libQt5Core.so appears to be in the right place:
wsy@max:/lib/x86_64-linux-gnu$ pwd
/lib/x86_64-linux-gnu
wsy@max:/lib/x86_64-linux-gnu$ ls -la libQt5Core*
-rw-r--r-- 1 root root 1204 Sep 23 09:02 libQt5Core.prl
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so -> libQt5Core.so.5.15.2
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so.5 -> libQt5Core.so.5.15.2
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so.5.15 -> libQt5Core.so.5.15.2
-rw-r--r-- 1 root root 5552552 Sep 23 09:02 libQt5Core.so.5.15.2
wsy@max:/lib/x86_64-linux-gnu$
Emptying LD_LIBRARY_PATH does not help.
libQt5Core.so appears to be in the right place:
wsy@max:/lib/x86_64-linux-gnu$ pwd
/lib/x86_64-linux-gnu
wsy@max:/lib/x86_64-linux-gnu$ ls -la libQt5Core*
-rw-r--r-- 1 root root 1204 Sep 23 09:02 libQt5Core.prl
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so -> libQt5Core.so.5.15.2
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so.5 -> libQt5Core.so.5.15.2
lrwxrwxrwx 1 root root 20 Sep 23 09:02 libQt5Core.so.5.15 -> libQt5Core.so.5.15.2
-rw-r--r-- 1 root root 5552552 Sep 23 09:02 libQt5Core.so.5.15.2
wsy@max:/lib/x86_64-linux-gnu$
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
Thanks for the update and re-test. I'll start looking into this.
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
A couple of questions for you:
- How is your OpenSCAD installed (e.g. normal, Snap, AppImage, etc.)? Which version is it?
- Did you test using the "pipes" transfer mechanism (found in the FreeCAD OpenSCAD WB preferences)?
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
Still have the bug with FreeCAD_weekly-builds-26720-Linux-Conda_glibc2.12-x86_64.AppImage
/usr/bin/openscad: /tmp/.mount_FreeCAGwvdPR/usr/lib/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/bin/openscad)
I can see the lib is installed - Debian bullseye:
libqt5core5a is already the newest version (5.15.2+dfsg-9).
Probably is a matter of linking to it - mentioned in an earlier post as a workaround - but missing the details.
I think one needs to set LD_LIBRARY_PATH in the shell that calls theAppImage - but nothing I tried worked.
,.,.
I see libQt5Core.so.5 is in /tmp/.mount_FreeCAGwvdPR/usr/lib/
/tmp/.mount_FreeCAK71CoQ/usr/lib$ ls libQt5Core*
libQt5Core.prl libQt5Core.so libQt5Core.so.5 libQt5Core.so.5.12 libQt5Core.so.5.12.9
Looks like the right version is missing? A build-bot that makes deb packages would be a good idea.
/usr/bin/openscad: /tmp/.mount_FreeCAGwvdPR/usr/lib/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/bin/openscad)
I can see the lib is installed - Debian bullseye:
libqt5core5a is already the newest version (5.15.2+dfsg-9).
Probably is a matter of linking to it - mentioned in an earlier post as a workaround - but missing the details.
I think one needs to set LD_LIBRARY_PATH in the shell that calls theAppImage - but nothing I tried worked.
,.,.
I see libQt5Core.so.5 is in /tmp/.mount_FreeCAGwvdPR/usr/lib/
/tmp/.mount_FreeCAK71CoQ/usr/lib$ ls libQt5Core*
libQt5Core.prl libQt5Core.so libQt5Core.so.5 libQt5Core.so.5.12 libQt5Core.so.5.12.9
Looks like the right version is missing? A build-bot that makes deb packages would be a good idea.
I would rather have questions that cannot be answered,
than answers that cannot be questioned’
Richard Feynman.
than answers that cannot be questioned’
Richard Feynman.
- thomas-neemann
- Veteran
- Posts: 11921
- Joined: Wed Jan 22, 2020 6:03 pm
- Location: Osnabrück DE 🇩🇪
- Contact:
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
here it works
OS: Ubuntu 20.04.1 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.26720 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 7bca26e)
Hash: 7bca26e7c14d4d43374ff7e0c8582735b249cbfd
Python version: 3.9.9
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: German/Germany (de_DE)
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
Which transfer mechanism are you using? Is this with the new pipe mechanism?
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
I did a bunch of digging - this appears to be a limitation of working with the AppImage distros.
Went back to running under Debian bullseye - 0.19 it works -
To recreate - just open OpenScad workbench - add openscad element and enter some code.. see errors..
Went back to running under Debian bullseye - 0.19 it works -
To recreate - just open OpenScad workbench - add openscad element and enter some code.. see errors..
I would rather have questions that cannot be answered,
than answers that cannot be questioned’
Richard Feynman.
than answers that cannot be questioned’
Richard Feynman.
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
As information is little scattered this one having multiple bug tickets, I will gather all I found first to here:
1) Original bug ticket with suggested good fix:
https://tracker.freecadweb.org/view.php?id=4343
2) Same ticket opened as a 2 new tickets for freecad-bundle on github
https://github.com/FreeCAD/FreeCAD-Bundle/issues/56
https://github.com/FreeCAD/FreeCAD-Bundle/issues/107
1) Original bug ticket with suggested good fix:
https://tracker.freecadweb.org/view.php?id=4343
2) Same ticket opened as a 2 new tickets for freecad-bundle on github
https://github.com/FreeCAD/FreeCAD-Bundle/issues/56
https://github.com/FreeCAD/FreeCAD-Bundle/issues/107
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
Fix is to patch the /usr/Mod/OpenSCAD/OpenSCADUtils.py function so that the libraries are first tried to load from the linux distro before fallbacking to appimage versions when launching the openscad executable.<class 'OpenSCADUtils.OpenSCADError'>: " /usr/bin/openscad: /tmp/.mount_FreeCAhhHfre/usr/lib/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/bin/openscad)\n/usr/bin/openscad: /tmp/.mount_FreeCAhhHfre/usr/lib/libQt5Core.so.5: version `Qt_5.15' not found (required by /lib64/libqscintilla2_qt5.so.15)\n"
Reason why this fix is needed is that when the freecad launches the external openscad from appimage,
the external openscad depends from the distro specific library versions instead of the one offered by the appimage.
In my case from the libqscintilla2_qt5.so.15 is not available in appimage and that depends from the qt5.15 version and try to load the libQt5Core.so.5.
But in freecad appimage the symlink
/tmp/.mount_FreeCAhhHfre/usr/lib/libQt5Core.so.5
points to libQt5Core.so.5.12.9 that is available in appimage instead of using the
/usr/lib64/libQt5Core.so.5
from linux distro that points to /usr/lib64/libQt5Core.so.5.15.2 and therefore the wrong version is found.
So it worked also for me to add the distro's librarypath before launching the openscad.
At least in my case I needed to do that to also in other function call where the openscad were called to check the version number.
So here is the full patch I needed:
Code: Select all
diff -Naur freecad_appimage_orig/usr/Mod/OpenSCAD/OpenSCADUtils.py freecad_appimage_fixed/usr/Mod/OpenSCAD/OpenSCADUtils.py
--- freecad_appimage_orig/usr/Mod/OpenSCAD/OpenSCADUtils.py 2022-07-10 20:49:58.231874740 -0700
+++ freecad_appimage_fixed/usr/Mod/OpenSCAD/OpenSCADUtils.py 2022-07-10 22:09:17.289272855 -0700
@@ -142,12 +142,31 @@
"User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
GetString('openscadexecutable')
if osfilename and os.path.isfile(osfilename):
- with subprocess.Popen([osfilename, '-v'],\
- stdout = subprocess.PIPE,stderr=subprocess.PIPE, universal_newlines=True) as p:
+ env = os.environ.copy()
+ try:
+ env.pop('LD_LIBRARY_PATH')
+ except KeyError:
+ None
+ def check_output2(*args, **kwargs):
+ env = os.environ.copy()
+ try:
+ env.pop('LD_LIBRARY_PATH')
+ except KeyError:
+ None
+ kwargs.update({'stdout':subprocess.PIPE,'stderr':subprocess.PIPE,'env':env})
+ p = subprocess.Popen(*args, **kwargs)
p.wait()
- stdout = p.stdout.read().strip()
- stderr = p.stderr.read().strip()
- return (stdout or stderr)
+ stdoutd = p.stdout.read().decode("utf8")
+ stderrd = p.stderr.read().decode("utf8")
+ if p.returncode != 0:
+ raise OpenSCADError('%s %s\n' % (stdoutd.strip(),stderrd.strip()))
+ #raise Exception,'stdout %s\n stderr%s' %(stdoutd,stderrd)
+ if stderrd.strip():
+ FreeCAD.Console.PrintWarning(stderrd+u'\n')
+ if stdoutd.strip():
+ FreeCAD.Console.PrintMessage(stdoutd+u'\n')
+ return (stdoutd or stderrd)
+ return check_output2([osfilename, '-v'])
def newtempfilename():
@@ -173,7 +192,12 @@
import time
def check_output2(*args, **kwargs):
- kwargs.update({'stdout':subprocess.PIPE,'stderr':subprocess.PIPE})
+ env = os.environ.copy()
+ try:
+ env.pop('LD_LIBRARY_PATH')
+ except KeyError:
+ None
+ kwargs.update({'stdout':subprocess.PIPE,'stderr':subprocess.PIPE,'env':env})
p = subprocess.Popen(*args, **kwargs)
stdoutd, stderrd = p.communicate()
stdoutd = stdoutd.decode("utf8")
I applied the fix in a following way to existing freecad 0.20.0 appimage to test it.
- 1) Extract appimage
./FreeCAD-0.20.0-Linux-x86_64.AppImage --appimage-extract - Move directory containing extracted appimage files
cd squashfs-root - Patch appimage with openscan launch fix for qt5 version problem
patch -p1 < ../freecad_appimage_020_openscad_qt5_15_launch_fix.patch - Move back to appimage directory
cd .. - Download appimagetool to create new appimage from fixed appimage files
https://github.com/AppImage/AppImageKit/releases - Generate new appimage with fix. This will generate a image with name "FreeCAD_Weekly-x86_64.AppImage"
./appimagetool-x86_64.AppImage ./squashfs-root - Launch new appimage to test the openscad bug
./FreeCAD_Weekly-x86_64.AppImage
Last edited by lamikr on Wed Jul 13, 2022 5:37 pm, edited 1 time in total.
Re: Ticket #4343 - OPENSCAD not working with AppImage distros
Please edit your post and put the code and output in code tags using the button </>. That makes the post easier to read and shows immediately if there are indentations or not.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.