[fixed] need help to understand why import ImportGui fails

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!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[fixed] need help to understand why import ImportGui fails

Post by uwestoehr »

I am in the making of a Windows build for FC 0.19.3 and I am stuck.

Upon my request to test my builds I realized that it cannot handle STEP files. I could track it down to ImportGui but don't know how to fix it.

In the Python console of my build I enter:

Code: Select all

>>>  import ImportGui
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "D:\FreeCAD-build\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
ImportError: DLL load failed while importing ImportGui: Das angegebene Modul wurde nicht gefunden.
>>> import PartGui
>>> import PartDesignGui
So importing ImportGui fails while e.g. importing PartGui works without problems.
The problem only exists with the latest LibPack 12.5.3. With LibPack 12.5.2 it works fine but this LibPack contains an older OCC 7.5 version and the users want to benefit from fixes in the handling of STEP by OCC.

I guess the problem is somewhere in a CMake file but I have almost no knowledge about CMake. Does anybody has an idea or could point me to files I should look at?

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24365 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: c5eca93a2070fe67957350ef8371e53027364c69
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.2
Locale: German/Germany (de_DE)
wmayer wrote: .
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: need help to understand why import ImportGui fails

Post by uwestoehr »

chennes wrote: .
sgrogan wrote: Sat Jul 22, 2017 2:24 pm .
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: need help to understand why import ImportGui fails

Post by uwestoehr »

I tested now all Workbenches and I get the same error when I load
- Gui.activateWorkbench("FemWorkbench")
- Gui.activateWorkbench("TechDrawWorkbench")

Also the Start WB shows broken HTML code is if a CSS file is broken.

I have no explanation why other WBs like PartDesign or Sketcher work well. I thought that when I made a mistake in my compilation setup it will affect all WBs.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: need help to understand why import ImportGui fails

Post by uwestoehr »

I could boil down all issues down to one single DLL: TKService.dll

So when I take the LibPack but only replace this single DLL:
TKService-OOC752-buggy.zip
(343.39 KiB) Downloaded 39 times
and use instead the one from the prior LibPack that uses OCC 7.5.0:
TKService-OCC-750.zip
(623.32 KiB) Downloaded 43 times
everything works fine for me so far.

Here is a new Windows installer I built with the result: https://github.com/donovaly/FreeCADInst ... ller-3.exe

It uses the latest LibPack, meaning OCC 7.5.2. Additionally
- I upgraded Qt to 5.15.2
- I fixed two CMake errors: https://github.com/apeltauer/FreeCAD/issues/13
- use the TKService.dll from OCC 7.5.0 (taken from the prior LibPack)
Here is the resulting LibPack I got and used to build (the changed TKService.dll is not included): https://github.com/donovaly/FreeCADInst ... ixes_US.7z

I don't know now how to proceed. Is it OK to keep the single DLL from OCC 7.5.0 and use all other from OCC 7.5.2? If so, I would release the Win installer in that state - if I get no error reports from it in the announcement thread: https://forum.freecadweb.org/viewtopic.php?f=9&t=64025
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: need help to understand why import ImportGui fails

Post by wmayer »

ImportError: DLL load failed while importing ImportGui: Das angegebene Modul wurde nicht gefunden.
Use the tool dependency walker to see all dependencies to further dlls of a given dll. Since you already know that TKService.dll causes problems then load it with the tool and in case of missing dlls they should be listed.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: need help to understand why import ImportGui fails

Post by uwestoehr »

wmayer wrote: Sun Nov 28, 2021 9:58 am Use the tool dependency walker to see all dependencies to further dlls of a given dll. Since you already know that TKService.dll causes problems then load it with the tool and in case of missing dlls they should be listed.
Many thanks! I did not know this tool before.

It shows that it depends on a missing LIBFREETYPE-6__.DLL:
depends_xUkDzvq2wy.png
depends_xUkDzvq2wy.png (24.2 KiB) Viewed 1996 times
This dependency is not necessary. It came it because of a wrong CMake include setting once OCC was compiled as I found out.
Since this dependency is not necessary, here the result of TKService.dll from the LibPack with which we released FC 0.19.2:
depends_Lc1S6ZYjSW.png
depends_Lc1S6ZYjSW.png (24.98 KiB) Viewed 1996 times

I think it is safe the to make the release as I did it in my test build: only the TKService.dll is the one from the prior LibPack. dependency walker shows me that in this case all DLL used by dependency walker are the ones from OCC 7.5.2. So users can benefit from the OCC 7.5.x fixes.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: need help to understand why import ImportGui fails

Post by uwestoehr »

For the records, here is a fixed LibPack in which I fixed all issues I listed described here: https://github.com/apeltauer/FreeCAD/issues/19

https://github.com/donovaly/FreeCADInst ... ixes_US.7z
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [fixed] need help to understand why import ImportGui fails

Post by uwestoehr »

@apeltauer released today a new LibPack and in this the issue I reported here is fixed: https://github.com/apeltauer/FreeCAD/re ... ack_12.5.4
Post Reply