Updated to latest LibPack, cannot start PartDesign - please help!

Having trouble installing or compiling FreeCAD? Get help here.
falviani
Posts: 221
Joined: Tue May 07, 2019 8:49 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by falviani »

Hi Adrian,

Here is what I have done:
1) I removed all versions of python (3.5 & 3.7) prior to 3.8 [my latest version] from path variables, restarted.
2) Clean and build.
3) Still get the can't load module error on switching to part design.
4) Remove python 3.8, restart.
5) Clean and build.
6) STILL get the can't load module error.

Code: Select all

11:17:53  Wizard shaft module cannot be loaded
11:17:53  DLL load failed while importing PartDesignGui: The specified procedure could not be found.
11:17:53  Traceback (most recent call last):
  File "<string>", line 53, in Initialize
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
I have attached the build log. Searching for Wizard shows all steps in building the wizard shaft module.
Checking the directory shows the following;'
WizardShaft.png
WizardShaft.png (50.85 KiB) Viewed 198 times
demonstrating that the module is indeed where it's expected.

I don't believe OCC has anything to do with this error. I believe (but can't prove, due to a lack of intimate knowledge) that the shiboken software is not generating whatever is required to find the Wizard shaft module.

How can this get reported to somebody who can investigate and hopefully fix?

Thanks for all your suggestions and time,
Frank
Attachments
BuildLog_22June22-11-15AM.txt
(376.05 KiB) Downloaded 1 time
adrianinsaval
Veteran
Posts: 2588
Joined: Thu Apr 05, 2018 5:15 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by adrianinsaval »

@wmayer any clues?
adrianinsaval
Veteran
Posts: 2588
Joined: Thu Apr 05, 2018 5:15 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by adrianinsaval »

Does the same happen if you make a release build instead of a debug one?
falviani
Posts: 221
Joined: Tue May 07, 2019 8:49 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by falviani »

Let me figure out how to do that, and I'll report the results.
falviani
Posts: 221
Joined: Tue May 07, 2019 8:49 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by falviani »

Hi,

Figured out how to build release version (thanks to improved build documentation). Did a clean and build. When I launched I got the same error as always:

Code: Select all

13:46:00  Wizard shaft module cannot be loaded
13:46:01  DLL load failed while importing PartDesignGui: The specified procedure could not be found.
13:46:01  Traceback (most recent call last):
  File "<string>", line 53, in Initialize
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
This must be a subtle bug if I'm the only person having this problem :(

Frank
falviani
Posts: 221
Joined: Tue May 07, 2019 8:49 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by falviani »

Hi,

A little further info - part design isn't the only workbench with a failure to import module error:

Path workbench:

Code: Select all

17:30:07  DLL load failed while importing Path: The specified procedure could not be found.
17:30:07  Traceback (most recent call last):
  File "<string>", line 62, in Initialize
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "E:\Dev\FreeCAD19_Output\Mod\Path\PathScripts\PathPreferencesPathJob.py", line 24, in <module>
    import Path
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
Part:

Code: Select all

17:31:52  DLL load failed while importing PartGui: The specified procedure could not be found.
17:31:52  Traceback (most recent call last):
  File "<string>", line 43, in Initialize
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
Sketcher:

Code: Select all

17:32:43  DLL load failed while importing SketcherGui: The specified procedure could not be found.
17:32:43  Traceback (most recent call last):
  File "<string>", line 43, in Initialize
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
This is more broken than I thought.

Still, thanks for investing your time to try and help.
Frank
wmayer
Founder
Posts: 18621
Joined: Thu Feb 19, 2009 10:32 am

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by wmayer »

1) Good: I found there was a global environment variable named "FreeCAD_LibPack_bin" that had the old libpack path defined. I updated it to the correct path and that error was eliminated. It feels like this is a leftover from a previous CMake process; perhaps somebody needs to look at this?
The only reference of FREECAD_LIBPACK_BIN in FreeCAD source code is inside FreeCADInit.py.

In Py3.8 on Windows there was a change to ignore the PATH environment variable (I guess to avoid DLL hijacking) and each path where a Python extension module should be loaded from must be registered with os.add_dll_directory() beforehand. The FREECAD_LIBPACK_BIN is only relevant for those people (like me) who don't want to copy all the DLLs of the LibPack to the build directory and therefore you can define this environment variable to point to the LibPack's bin directory. But this variable is not defined by CMake or the like, it's you who has to define it.
2) Not-so-good: I am still getting the following complaint, which seems to be enough to prevent PartDesignGui from loading:
The error message The specified procedure could not be found actually means that the DLL could be found but it was the wrong version because it's apparently binary incompatible.
Sigh. I don't know who to report this problem to, but I seem to be out of luck. It is frustrating to have a 100% successful build and then have this happen at runtime (the log file shows nothing wrong during the initialization phase for PartDesign).
Two ways to locate the problem:
If you have a debug build then start FreeCAD from within VS. If FreeCAD has fully started switch to VS and clear its Output Window. Switch back to FreeCAD and try to load PartDesign. Switch again back to VS and carefully check the output messages. You should see some messages about loaded DLLs and at some point it starts to unload some of these DLLs. What is the first unloaded DLL and is it located in the correct directory.

Another way is to use the Dependency Walker (DW) to check for mismatching DLLs. So, start FreeCAD as usual and after it is running switch to its Python console. There enter

Code: Select all

import os
os.system("Path_to_depends.exe") # the path to the DW application
Inside DW load the file _PartDesign.pyd and PartDesignGui.pyd and check the paths to 3rd party modules. Are they correct?
4) After ensuring the project was set to use C++17 (I have to do this everytime I build - very annoying that it's not persistant) I did a clean then build of the entire project.
Then there must be something wrong with your setup. C++17 is the minimum version since v0.20.
I believe (but can't prove, due to a lack of intimate knowledge) that the shiboken software is not generating whatever is required to find the Wizard shaft module.
The error message is confusing that prints something about shiboken if loading a module has failed. The point is that shiboken has implemented a user-defined import function that jumps in if the regular import mechanism has failed.
A little further info - part design isn't the only workbench with a failure to import module error:
What about Mesh or any other workbench that doesn't depend on OCC?
falviani
Posts: 221
Joined: Tue May 07, 2019 8:49 pm

Re: Updated to latest LibPack, cannot start PartDesign - please help!

Post by falviani »

Hello Mr. Mayer,

Here are the results of my following your suggestions (in order you gave them):

1) With a debug build, opening Freecad from within VS, switching to PartDesign and then switching back to VS resulted in nothing in the output window at all.

2) I downloaded the dependency walker as suggested and opened the partdesign DLL. It took a VERY long time to process.
a) I got the following errors in the output panel:

Code: Select all

Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
b) All of the following files reported "Error opening file. The system cannot find the file specified"

Code: Select all

EXT-MS-WIN-STORAGE-SENSE-L1-1-0.DLL
EXT-MS-WIN-STORAGE-SENSE-L1-2-0.DLL
EXT-MS-WIN-SXS-OLEAUTOMATION-L1-1-0.DLL
EXT-MS-WIN-TSF-MSCTF-L1-1-0.DLL
EXT-MS-WIN-TSF-MSCTF-L1-1-1.DLL
EXT-MS-WIN-UI-VIEWMANAGEMENT-L1-1-0.DLL
EXT-MS-WIN-USP10-L1-1-0.DLL
EXT-MS-WIN-WER-UI-L1-1-0.DLL
EXT-MS-WIN-WER-XBOX-L1-1-0.DLL
EXT-MS-WIN-WEVTAPI-EVENTLOG-L1-1-0.DLL
EXT-MS-WIN-WINRT-DEVICE-ACCESS-L1-1-0.DLL
EXT-MS-WIN-WINRT-STORAGE-L1-1-0.DLL
EXT-MS-WIN-WLAN-ONEXUI-L1-1-0.DLL
EXT-MS-WIN-WLAN-SCARD-L1-1-0.DLL
EXT-MS-WIN-WPC-WEBFILTER-L1-1-0.DLL
EXT-MS-WIN-WWAN-WWAPI-L1-1-0.DLL
EXT-MS-WIN-WWAN-WWAPI-L1-1-1.DLL
EXT-MS-WIN32-SUBSYSTEM-QUERY-L1-1-0.DLL
EXT-MS-WINDOWSCORE-DEVICEINFO-L1-1-0.DLL
HVSIFILETRUST.DLL
IESHIMS.DLL
3) From a fresh launch of FreeCAD, Mesh Design opened without errors - except in the report view:

Code: Select all

09:59:52  Loading GUI of Mesh module... done
09:59:52  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "E:\Dev\FreeCAD19_Output\Mod\MeshPart\MeshFlatteningCommand.py", line 26, in <module>
    import Part
  File "E:\Dev\FreeCAD19_Output\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
<class 'ImportError'>: DLL load failed while importing Part: The specified procedure could not be found.
09:59:52  DLL load failed while importing flatmesh: The specified procedure could not be found.8.91326 
The sad part is that this source always builds with 100% successful projects, 0 errors reported.

Thank you for your time and effort. I hope that when this is finally resolved the build instructions can be updated with any lessons learned in terms of non-obvious configuration requirements.

-Frank Alviani
Post Reply