LD_PRELOAD Error when using OpenSCAD workbench

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
whoneyc
Posts: 22
Joined: Tue Apr 20, 2021 9:44 pm

LD_PRELOAD Error when using OpenSCAD workbench

Post by whoneyc »

Attempting to create an OpenSCAD object elicits an LD_PRELOAD error.

Specific Error Message:

Code: Select all

16:35:25   ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.
Can't open input file '/tmp/fc-09626-452490-000001.scad'!
Environment:

Code: Select all

OS: Ubuntu 18.04.5 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: c240777a7de9fbb69472e6cbf589e83559a9ef17
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.5.1
Locale: English/UnitedStates (en_US)
I believe I am using the snap package here. This is the version from apt-get "2:0.19+dfsg1~202103010521~ubuntu18.04.1"

Steps to reproduce (on my machine):
  1. Start a new document in FreeCAD
  2. Switch to the OpenSCAD workbench
  3. Use the command "OpenSCAD" > "Add an OpenSCAD Element"
  4. In the combo view, the task pops up to add code. Here, I use the default code cube(); and click "OK".
  5. Error
System LD_PRELOAD info:
  • Using echo $LD_PRELOAD reports /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0. This is correct for my system.
  • Many other reports on SO suggest this is an x86 problem. I confirmed that I have the correct package installed by using sudo apt-get install libgtk3-nocsd0:i386.


I have done everything I could think of for now. A related issue raised on the forums (here) had no positive outcomes (I promise to report results!) so I'd like to check if there is anything else I should try first. The bug suggested in that thread appears to not apply to my problem, and unlike the user in the linked issue, I did NOT see a segfault.



-----------------------------------------

Edit: Solution - Users of FreeCAD should avoid using OpenSCAD Snaps in their workflow. Use an AppImage or apt package. Snaps will break things. Details of findings are later in this thread.
Last edited by whoneyc on Wed Apr 28, 2021 6:45 pm, edited 2 times in total.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by keithsloan52 »

whoneyc wrote: Tue Apr 20, 2021 10:05 pm Attempting to create an OpenSCAD object elicits an LD_PRELOAD error.

Specific Error Message:

Code: Select all

16:35:25   ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.
Can't open input file '/tmp/fc-09626-452490-000001.scad'!
Environment:

Code: Select all

OS: Ubuntu 18.04.5 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: c240777a7de9fbb69472e6cbf589e83559a9ef17
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.5.1
Locale: English/UnitedStates (en_US)
I believe I am using the snap package here.

Steps to reproduce (on my machine):
  1. Start a new document in FreeCAD
  2. Switch to the OpenSCAD workbench
  3. Use the command "OpenSCAD" > "Add an OpenSCAD Element"
  4. In the combo view, the task pops up to add code. Here, I use the default code cube(); and click "OK".
  5. Error
System LD_PRELOAD info:
  • Using echo $LD_PRELOAD reports /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0. This is correct for my system.
  • Many other reports on SO suggest this is an x86 problem. I confirmed that I have the correct package installed by using sudo apt-get install libgtk3-nocsd0:i386.


I have done everything I could think of for now. A related issue raised on the forums (here) had no positive outcomes (I promise to report results!) so I'd like to check if there is anything else I should try first. The bug suggested in that thread appears to not apply to my problem, and unlike the user in the linked issue, I did NOT see a segfault.
A quick google of the error message gets a number of hits, looks like it is related to Ubuntu.
This link https://stackoverflow.com/questions/538 ... -preloaded
Looks promising to me
whoneyc
Posts: 22
Joined: Tue Apr 20, 2021 9:44 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by whoneyc »

keithsloan52 wrote: Wed Apr 21, 2021 7:49 pm A quick google of the error message gets a number of hits, looks like it is related to Ubuntu.
This link https://stackoverflow.com/questions/538 ... -preloaded
Looks promising to me
Thanks for the suggestion Keith. That was the first thing I saw when searching too. I tested it out originally, and I have already installed libgtk3-nocsd0:i386 and I have the correct environmental variable for LD_PRELOAD. If you'll glance down at the section titled System LD_PRELOAD info in the OP, I have results there that confirm this.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by keithsloan52 »

Out of interest what version of OpenSCAD have you installed?
whoneyc
Posts: 22
Joined: Tue Apr 20, 2021 9:44 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by whoneyc »

keithsloan52 wrote: Thu Apr 22, 2021 7:22 am Out of interest what version of OpenSCAD have you installed?
Version 2:0.19+dfsg1~202103010521~ubuntu18.04.1

It looks like I downloaded it from apt-get, not snap as I said in the OP. I will correct that.

Ninja edit: I just noticed you were looking for the OpenSCAD version. My reading comprehension must drop after dinner. I'm running the OpenSCAD-nightly package. The current version is "2021.04.14".
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by keithsloan52 »

whoneyc wrote: Thu Apr 22, 2021 11:16 pm
keithsloan52 wrote: Thu Apr 22, 2021 7:22 am Out of interest what version of OpenSCAD have you installed?
Version 2:0.19+dfsg1~202103010521~ubuntu18.04.1

It looks like I downloaded it from apt-get, not snap as I said in the OP. I will correct that.

Ninja edit: I just noticed you were looking for the OpenSCAD version. My reading comprehension must drop after dinner. I'm running the OpenSCAD-nightly package. The current version is "2021.04.14".
You might try OpenSCAD version 2019.5 to see if it has the same problem.
You can find by following the link to Prior Releases on https://openscad.org/downloads.html#priorreleases
whoneyc
Posts: 22
Joined: Tue Apr 20, 2021 9:44 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by whoneyc »

keithsloan52 wrote: Fri Apr 23, 2021 8:04 am You might try OpenSCAD version 2019.5 to see if it has the same problem.
You can find by following the link to Prior Releases on https://openscad.org/downloads.html#priorreleases
I downloaded the 2019.05 AppImage, made it executable, and linked it in FreeCAD. Running the same test as in the OP, I am able to summon a cube. Some warnings were issued by FreeCAD, but no errors. Log below:

Code: Select all

12:32:11  ImportCSG Version 0.6a
12:32:11  Start Lex
12:32:11  End Lex
12:32:11  Load Parser
12:32:11  WARNING: Token 'DOT' defined, but not used
12:32:11  WARNING: Token 'WORD' defined, but not used
12:32:11  WARNING: There are 2 unused tokens
12:32:11  WARNING: Couldn't create 'parsetab'. [Errno 13] Permission denied: '/usr/share/freecad/Mod/OpenSCAD/parsetab.py'
12:32:11  Parser Loaded
12:32:11  Start Parser
12:32:11  size vector
12:32:11  ('size', ['1', '1', '1'])
12:32:11  ('center', 'false')
12:32:11  cube :  {'size': ['1', '1', '1'], 'center': 'false'}
12:32:11  End Cube
12:32:11  End Parser
12:32:11  [<Part::PartFeature>]
12:32:11  End processing CSG file
Out of curiosity, I also downloaded the latest AppImage (2021.01) and did the same steps. This also created the cube with the same warnings.

What is the takeaway here? The two successes here suggest that the prebuilt AppImage likely have the correct linking baked into the redistributed package. So where does the problem with the linking libraries occur? Is it on my end? Is there something funny going on with the OpenSCAD nightlies? I need to know if there is a problem with the nightlies to bring up as a bug on the OpenSCAD side or if I have something wrong with my configuration.

Actionable: Do any other FreeCAD users run the openscad-nightly package in FreeCAD? Can you make a cube without errors?
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by keithsloan52 »

whoneyc wrote: Fri Apr 23, 2021 5:46 pm
keithsloan52 wrote: Fri Apr 23, 2021 8:04 am You might try OpenSCAD version 2019.5 to see if it has the same problem.
You can find by following the link to Prior Releases on https://openscad.org/downloads.html#priorreleases
I downloaded the 2019.05 AppImage, made it executable, and linked it in FreeCAD. Running the same test as in the OP, I am able to summon a cube. Some warnings were issued by FreeCAD, but no errors. Log below:

Code: Select all

12:32:11  ImportCSG Version 0.6a
12:32:11  Start Lex
12:32:11  End Lex
12:32:11  Load Parser
12:32:11  WARNING: Token 'DOT' defined, but not used
12:32:11  WARNING: Token 'WORD' defined, but not used
12:32:11  WARNING: There are 2 unused tokens
12:32:11  WARNING: Couldn't create 'parsetab'. [Errno 13] Permission denied: '/usr/share/freecad/Mod/OpenSCAD/parsetab.py'
12:32:11  Parser Loaded
12:32:11  Start Parser
12:32:11  size vector
12:32:11  ('size', ['1', '1', '1'])
12:32:11  ('center', 'false')
12:32:11  cube :  {'size': ['1', '1', '1'], 'center': 'false'}
12:32:11  End Cube
12:32:11  End Parser
12:32:11  [<Part::PartFeature>]
12:32:11  End processing CSG file
Out of curiosity, I also downloaded the latest AppImage (2021.01) and did the same steps. This also created the cube with the same warnings.

What is the takeaway here? The two successes here suggest that the prebuilt AppImage likely have the correct linking baked into the redistributed package. So where does the problem with the linking libraries occur? Is it on my end? Is there something funny going on with the OpenSCAD nightlies? I need to know if there is a problem with the nightlies to bring up as a bug on the OpenSCAD side or if I have something wrong with my configuration.

Actionable: Do any other FreeCAD users run the openscad-nightly package in FreeCAD? Can you make a cube without errors?
Those warnings are normal(?) - Should really have tidied them up years ago. The first two are due to redundant definitions for the parser.
Cannot remember the reason for the permissions warning but don't think parsetab.py is used.

The rest are mostly stray print statements from debugging.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by keithsloan52 »

whoneyc wrote: Fri Apr 23, 2021 5:46 pm
Out of curiosity, I also downloaded the latest AppImage (2021.01) and did the same steps. This also created the cube with the same warnings.

What is the takeaway here? The two successes here suggest that the prebuilt AppImage likely have the correct linking baked into the redistributed package. So where does the problem with the linking libraries occur? Is it on my end? Is there something funny going on with the OpenSCAD nightlies? I need to know if there is a problem with the nightlies to bring up as a bug on the OpenSCAD side or if I have something wrong with my configuration.

Actionable: Do any other FreeCAD users run the openscad-nightly package in FreeCAD? Can you make a cube without errors?
Worth remembering the OpenSCAD workbench invokes OpenSCAD via its command line interface passing in data, might shed some light.
whoneyc
Posts: 22
Joined: Tue Apr 20, 2021 9:44 pm

Re: LD_PRELOAD Error when using OpenSCAD workbench

Post by whoneyc »

keithsloan52 wrote: Fri Apr 23, 2021 9:14 pm Worth remembering the OpenSCAD workbench invokes OpenSCAD via its command line interface passing in data, might shed some light.
I did some digging based on this suggestion. Using the commands in OpenSCADUtils.py and seeing how they are called in OpenSCADCommands.py, I was able to do some tests.

I attempted to open a file stored at /tmp/freecadfile.scad with both the standard and nightly versions of OpenSCAD on my computer.
Naturally, openscad-nightly was unable to open the file. I tested another .scad file on my system NOT stored in /tmp, and both binaries were able to open the file. I finally ran the openscad-nightly gui and attempted to open the temp file that way. However, it was hidden from the browser. All that was available to me were ghost .csg files which have since been deleted.

Conclusions: There is something very bizarre going on with openscad-nightly not able to access temporary files. I will be raising an issue on their code. For now, I would recommend FreeCAD users not use the nightly package, unless they are feeling brave and would like to provide feedback.
Post Reply