[Fixed] Windwos Qt 5.15 Shiboken failure

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!
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Windows Qt 5.15 Shiboken failure

Post by sgrogan »

apeltauer wrote: Tue Nov 10, 2020 4:19 pm made a test libpack. Maybe some one can test it and may has a hint where to look....
In CMake configure I get a hard coded path

Code: Select all

Shiboken2Config: Using default python: .cp38-win_amd64
CMake Error at C:/Libpacks/FreeCADLibs_12.x_x64_VC17_test/lib/cmake/Shiboken2-5.15.0/Shiboken2Targets.cmake:82 (message):
  The imported target "Shiboken2::shiboken2" references the file

     "D:/Work/Componets/python/pyside-setup_install/bin/shiboken2.exe"

  but this file does not exist.  Possible reasons include:
I should be able to fix this and test further.
Last edited by Kunda1 on Sat Nov 14, 2020 3:24 pm, edited 1 time in total.
Reason: fixed typo in thread title
"fight the good fight"
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: Windwos Qt 5.15 Shiboken failure

Post by apeltauer »

wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

When running CMake configure I get this warning a few times an for some other targets, too:
CMake Warning (dev) at src/Base/CMakeLists.txt:405 (target_link_libraries):
Link library type specifier "optimized" is followed by specifier
"optimized" instead of a library name. The first specifier will be
ignored.
This warning is for project developers. Use -Wno-dev to suppress it.
The defined libs are:

Code: Select all

optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_filesystem-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_filesystem-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_program_options-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_program_options-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_regex-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_regex-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_system-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_system-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_thread-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_thread-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_chrono-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_chrono-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_date_time-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_date_time-vc141-mt-gd-x64-1_67.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_atomic-vc141-mt-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/boost_atomic-vc141-mt-gd-x64-1_67.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/xerces-c_3D.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/xerces-c_3.lib;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/zlib.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/lib/zlibd.lib;
debug;MSVCRTD.LIB;
debug;MSVCPRTD.LIB;optimized;MSVCRT.LIB;
optimized;MSVCPRT.LIB;Rpcrt4.lib;version.lib;
debug;vcruntimed.lib;
debug;ucrtd.lib;
debug;concrtd.lib;
optimized;vcruntime.lib;
optimized;ucrt.lib;
optimized;concrt.lib;
Qt5::Core;optimized;optimized;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/libs/python38.lib;
optimized;debug;
optimized;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/libs/python38_d.lib;
debug;C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/libs/python38_d.lib
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

When trying to build the smesh libs then I get this linker error:
Error LNK1104 cannot open file 'D:\Work\FC_Develop\FreeCadLibs\FreeCADLibs_12.x_x64_VC17_test\lib\freetype.lib'
As you can see the path in the CMake config file is hard-coded.

The affected files are OpenCASCADEVisualizationTargets.cmake and OpenCASCADEDrawTargets.cmake
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

apeltauer wrote: Mon Nov 09, 2020 4:39 pm Hi all,

after creating python 3.8 and shiboken from source i get the following error:

Code: Select all

17:34:14  Running the Python command 'Draft_Line' failed:
Traceback (most recent call last):
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\Mod\Draft\draftguitools\gui_lines.py", line 70, in Activated
    super(Line, self).Activated(name)
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\Mod\Draft\draftguitools\gui_base_original.py", line 290, in Activated
    super(Creator, self).Activated(name, noplanesetup)
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\Mod\Draft\draftguitools\gui_base_original.py", line 154, in Activated
    Gui.Snapper.setTrackers()
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\Mod\Draft\draftguitools\gui_snapper.py", line 1682, in setTrackers
    self.dim1 = trackers.archDimTracker(mode=2)
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\Mod\Draft\draftguitools\gui_trackers.py", line 1270, in __init__
    import SketcherGui
  File "D:\Work\FC_Develop\FreeCad_Dev2\bin\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)

DLL load failed while importing SketcherGui: The specified module could not be found.
Anyone a glue what i can do?
I can (partially) confirm this behaviour. When I start FreeCAD then independent on what is the startup wb I can only load a very view wb: Image, Points and Test. All other refuse to load with the error that a DLL cannot be loaded.

In the call stack shiboken2 appears too but only because it implements an import hook. It's not responsible for the problem which you can easily test by removing it from the site-packages directory.

What I have found out is that all extension modules that depend on a DLL of the LibPack which is not loaded by the core system cannot be loaded for some reason. So, Part doesn't load because it cannot find the OCCT DLLs, Mesh doesn't load because it doesn't find Qt5Concurrent.dll and so on.
The three wb Image, Points and Test load because they have no further dependencies.

What I found out too is that when copying the DLLs of the LibPack into FreeCAD's bin directory then e.g. the Part module can be imported. However, PartDesign still cannot be imported as long as Part is not loaded.

It seems that somehow the application completely ignores the PATH environment variable where to look for depending DLLs.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

apeltauer wrote: Mon Nov 09, 2020 4:39 pm Anyone a glue what i can do?
Btw, the netgen binaries are too old as they obviously are linked to an older version of OCCT (presumably 7.4).
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

When explicitly loading the OCCT dlls with

Code: Select all

from ctypes import *
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/Qt5Concurrent.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKBO.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKStep209.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKStep.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKIges.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKStl.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKBool.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKFeat.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKFillet.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKMeshVS.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKMesh.dll")
cdll.LoadLibrary("C:/Projects/FreeCADLibs_12.x_x64_VC17_test/bin/TKOffset.dll")
then suddenly the Part module can be imported. So, it seems that the PATH to load these dlls is ignored somehow.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

I finally found the answer here: https://github.com/Toblerity/Fiona/issues/851

So, it's Python 3.8 that now ignores the PATH environment variable.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Windwos Qt 5.15 Shiboken failure

Post by wmayer »

Fixed with git commit 82beefa98d

Hint: If you don't want to copy the dlls from the libpack to the build directory you have to set the environment variable FREECAD_LIBPACK_BIN that points to the bin directory of the libpack.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Fixed] Windwos Qt 5.15 Shiboken failure

Post by wmayer »

Another broken thing of this libpack is the numpy package. Whenever trying to import it one gets such an error message:
The current Numpy installation ('C:\\Projects\\FreeCADLibs_12.x_x64_VC17_test\\bin\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
Traceback (most recent call last):
File "<string>", line 42, in Initialize
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\Projects\FreeCAD_qt15\Mod\PartDesign\WizardShaft\WizardShaft.py", line 27, in <module>
from .Shaft import Shaft
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\Projects\FreeCAD_qt15\Mod\PartDesign\WizardShaft\Shaft.py", line 25, in <module>
from .SegmentFunction import SegmentFunction, IntervalFunction, StressFunction, TranslationFunction
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "D:\Projects\FreeCAD_qt15\Mod\PartDesign\WizardShaft\SegmentFunction.py", line 25, in <module>
import numpy as np
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
return original_import(name, *args, **kwargs)
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\lib\site-packages\numpy\__init__.py", line 305, in <module>
_win_os_check()
File "C:\Projects\FreeCADLibs_12.x_x64_VC17_test\bin\lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
raise RuntimeError(msg.format(__file__)) from None
Post Reply