Ticket #4343 - OPENSCAD not working with AppImage distros

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
gst0098
Posts: 6
Joined: Tue Nov 12, 2019 2:43 pm

Ticket #4343 - OPENSCAD not working with AppImage distros

Post by gst0098 »

Hello to all, I would like to thanks all the FreeCAD community for the great work done.
I'm writing to issue a bug, I don't now if this is the right place to do it, in case forgive me, I searched a developer-appimage section without success. There is a bug in the AppImage distros, all of them (I tried 0.18 and all 0.19 until the 18694 release.
The error is due to the different Qt library versions between AppImage decompressed app and the system it are running in (openscad being an external command should use these last ones). I'm using Arch Linux to the last (today) update and openscad is linked to Qt_5.13 while the Appimage conatins QT_5.10 (not sure about this exact number.

To reproduce the error: launch AppImage => open an openscad file.

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/hd/tmp/squashfs-root/usr/Mod/OpenSCAD/importCSG.py", line 78, in open
tmpfile=callopenscad(filename)
File "/home/hd/tmp/squashfs-root/usr/Mod/OpenSCAD/OpenSCADUtils.py", line 183, in callopenscad
check_output2([osfilename,'-o',outputfilename, inputfilename])
File "/home/hd/tmp/squashfs-root/usr/Mod/OpenSCAD/OpenSCADUtils.py", line 163, in check_output2
raise OpenSCADError('%s %s\n' % (stdoutd.strip(),stderrd.strip()))
<class 'OpenSCADUtils.OpenSCADError'>: " /usr/bin/openscad: /home/hd/tmp/squashfs-root/usr/lib/libQt5Core.so.5: version `Qt_5.13' not found (required by /usr/bin/openscad)\n/usr/bin/openscad: /home/hd/tmp/squashfs-root/usr/lib/libQt5Core.so.5: version `Qt_5.13' not found (required by /usr/lib/libqscintilla2_qt5.so.15)\n"

The fix is very simple to do and consists in changing the LD_LIBRARY_PATH env variable before launching the OpenSCAD external command, this is accomplished by the OpenSCADUtils.py. Please find the diff that makes the fix of OpenSCADUtils.py in the following lines.
Hopes the fix can be included in future releases of the AppImage in the meantime I'm using a patched version successfully.

Best regards to all,
Giuseppe

------------------ DIFF of OpenSCADUtils.py
134,135d133
< env = os.environ.copy()
< env['LD_LIBRARY_PATH'] = "/usr/lib/"
137c135
< stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True, env=env)
---
> stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True)
160,162c158
< env = os.environ.copy()
< env['LD_LIBRARY_PATH'] = "/usr/lib/"
< p=subprocess.Popen(*args,**kwargs,env=env)
---
> p=subprocess.Popen(*args,**kwargs)
Last edited by Kunda1 on Mon Dec 07, 2020 3:58 pm, edited 1 time in total.
Reason: Added ticket number to thread title
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: OPENSCAD not working with AppImage distros

Post by vocx »

gst0098 wrote: Tue Nov 12, 2019 3:04 pm ...
The fix is very simple to do and consists in changing the LD_LIBRARY_PATH env variable before launching the OpenSCAD external command, this is accomplished by the OpenSCADUtils.py.
keithsloan52 wrote: ping
What do you think?
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: OPENSCAD not working with AppImage distros

Post by sgrogan »

Welcome gst0098
I ping our AppImage guru.
triplus wrote:ping
"fight the good fight"
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OPENSCAD not working with AppImage distros

Post by keithsloan52 »

I see this as a Qt issue.

One has a Qt application invoking another Qt application, each built with a different level of Qt.
Need a Qt expert to pronoun on what is best way to handle. Seems Changing the Library referenced works, but is that the way it is supposed to be done?
gst0098
Posts: 6
Joined: Tue Nov 12, 2019 2:43 pm

Re: OPENSCAD not working with AppImage distros

Post by gst0098 »

Bug still there on the last AppImage (18947), if possible in the mean time while a better and more elegant solution is found, fix at least with the given method, I confirm after months of use that it works well also after system upgrade.

Giuseppe
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: OPENSCAD not working with AppImage distros

Post by looo »

Packaging openscad with conda and including it in the appimage might be one way to ensure compatibility.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4343 - OPENSCAD not working with AppImage distros

Post by Kunda1 »

bump regarding issue #4343
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4343 - OPENSCAD not working with AppImage distros

Post by Kunda1 »

bumping again
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4343 - OPENSCAD not working with AppImage distros

Post by Kunda1 »

bumping. Anyone interested in creating an openscad conda recipe ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
chennes
Veteran
Posts: 3906
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Ticket #4343 - OPENSCAD not working with AppImage distros

Post by chennes »

I've been doing some work on making OpenSCAD callable from FreeCAD even when one or the other app is sandboxed. Once there's an AppImage that includes the changes I've just made in git commit eb9f47048 I'll have a look into this. I'd like to find ways to allow FreeCAD to use whatever pre-existing OpenSCAD is installed on the system whenever possible.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply