FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

I have been following the instructions per "https://wiki.freecadweb.org/Compile_on_Windows"

My details:

Code: Select all

     - Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332
     - Python 3.8.10 [b](not the software store, but a direct download)[/b]
          -pip'd in numpy,Pyside2,shiboken2
     - source from https://github.com/sliptonic/FreeCAD
     - cmake version 3.23.2
              using generator "Visual Studio 17 2022" , x64 option
              Out of source build to a new dir.
              

cmake --build "my build dir" seems to work fine (though CMake config is: Debug;Release;MinSizeRel;RelWithDebInfo, which I have never liked ... I really just want Release, as I don't have debug versions of everything ..... I tried to not use cmake-gui but the command line must be huge)

I build an 2 exes: FreeCADC_d.exe and FreeCADCmd_d.exe

Running FreeCADC_d.exe I get lots of:

Code: Select all

"15:47:24  PySide2/__init__.py: Unable to import shiboken2 from  ... followed by a lot of my dirs"
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by chennes »

Which version of the LibPack are you using?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

LibPack-OCC76-V2
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by chennes »

And to clarify, you are using a system-installed version of Python, rather than the one in that LibPack?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

Not completely sure on that one as CMake may be driving the Python selection.

From the CMake config run I see:

Found Python3: C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/python.exe (found version "3.8.10") found components: Interpreter Development Development.Module Development.Embed
Found XercesC: optimized;C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/lib/xerces-c_3.lib;debug;C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/lib/xerces-c_3D.lib (found version "3.2.2")
Found ZLIB: optimized;C:/Usexxxxx/github/FreeCAD-LibPack/LibPack-OCC76-V2/lib/zlib.lib;debug;C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/lib/zlibd.lib (found version "1.2.11")
PyCXX found:
Headers: C:/Users/***/github/FreeCAD/src
Sources: C:/Users/***/github/FreeCAD/src/CXX
Version: 6.2.8

and

Shiboken2Config: Using default python: .cp38-win_amd64
Found PythonInterp: C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/python.exe (found suitable version "3.8.10", minimum required is "3")
Found PythonLibs: optimized;C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/libs/python38.lib;debug;C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/libs/python38_d.lib (found suitable version "3.8.10", minimum required is "3")
SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: 'C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/include'
SHIBOKEN_PYTHON_LIBRARIES computed to value: ''
libshiboken built for Release
===============================================
PySide2 Python module found at C:\Users\****\github\FreeCAD-LibPack\LibPack-OCC76-V2\bin\lib\site-packages\PySide2.
===============================================

Found Matplotlib: C:/Users/***/github/FreeCAD-LibPack/LibPack-OCC76-V2/bin/lib/site-packages/matplotlib (found version "3.3.3")
Platform is 64-bit, set -D_OCC64


So to me it says CMake is following the FreeCad install rules
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by GeneFC »

I am not sure what is going wrong.

I just compiled using the standard "Compile on Windows" instructions (exactly) and again everything worked perfectly. Using LibPack-OCC76-V2 and VS 2019.

I always select only "Release" for the actual VS compilation. I change absolutely nothing in terms of dependencies or other files.

If you do not need debug versions then I strongly recommend that you do not allow them to compile. There have been several problems with debug dependencies reported here over the past few months.

Gene
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

I have been compiling from a VS 2022 admin command window, and NOT using the VS GUI. Should I be able to change the build config to only Release and get the same results?

Oh and I am using VS 2022 (17)
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by chennes »

GeneFC wrote: Thu Jul 28, 2022 11:17 pm I always select only "Release" for the actual VS compilation. I change absolutely nothing in terms of dependencies or other files.
Right - in fact, last time I tried I was unable to use any modules that required numpy in anything except Release mode. So while I do compile in Debug most of the time, it means I can't use e.g. Path, etc.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

Well I kinda held my nose and used MSVS, I have only used their compilers before.

So opening the .sln file ... then selecting Release ..... a few moments later I got a FreeCAD.exe built where I expected it. ( did I miss this in the write up ... that it has to be a sln file, toggle to release, then build?)

Ultimately FreeCad.exe opened as expected ... and the Python console processed:
>>> a=5
>>> print(a)
5

As I am working with the Path module looks like a lot of print statements are in my future ;)

Assuming it works till tomorrow....

So for now I will live with MSVS GUI ...
CandL
Posts: 85
Joined: Thu Oct 29, 2020 6:41 pm

Re: FreeCAD 0.20 Win 11 VS 2022 shiboken2 issues

Post by CandL »

Well closer but not quite usable... I tried to run:

Code: Select all

FreeCADCmd.exe --run-test 0
The common error is: ImportError: DLL load failed while importing FreeCADGui: The specified module could not be found.

Code: Select all

======================================================================
ERROR: TestAddonManagerApp (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: TestAddonManagerApp
Traceback (most recent call last):
  File "C:\Python38\Lib\unittest\loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "C:\Users\***\github\FreeCAD\FreeCad_build_new\Mod\AddonManager\TestAddonManagerApp.py", line 26, in <module>
    from AddonManagerTest.app.test_utilities import (
  File "C:\Users\***\github\FreeCAD\FreeCad_build_new\Mod\AddonManager\AddonManagerTest\app\test_utilities.py", line 29, in <module>
    from Addon import Addon
  File "C:\Users\****\github\FreeCAD\FreeCad_build_new\Mod\AddonManager\Addon.py", line 30, in <module>
    from addonmanager_macro import Macro
  File "C:\Users\*****a\github\FreeCAD\FreeCad_build_new\Mod\AddonManager\addonmanager_macro.py", line 39, in <module>
    from addonmanager_utilities import remove_directory_if_empty, is_float
  File "C:\Python38\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Users\****\github\FreeCAD\FreeCad_build_new\Mod\AddonManager\addonmanager_utilities.py", line 34, in <module>
    import FreeCADGui
  File "C:\Python38\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 FreeCADGui: The specified module could not be found.


======================================================================
ERROR:

Now I am launching the exe from an admin command prompt while in the bin dir. Now I thought dlls in the same loc as the exe where loaded automatically as needed.

Code: Select all

dir *.exe

 Directory of C:\Users\xxxx\github\FreeCAD\FreeCad_build_new\bin

07/28/2022  08:36 PM           136,704 FreeCAD.exe
07/28/2022  08:30 PM           123,392 FreeCADCmd.exe
dir *.dll
 Volume in drive C is Windows
 Volume Serial Number is 445E-5271

 Directory of C:\Users\****\github\FreeCAD\FreeCad_build_new\bin

07/28/2022  08:29 PM            40,960 Driver.dll
07/28/2022  08:29 PM            31,232 DriverDAT.dll
07/28/2022  08:29 PM            94,208 DriverSTL.dll
07/28/2022  08:29 PM           123,904 DriverUNV.dll
07/29/2022  10:31 AM         4,272,640 FreeCADApp.dll
07/29/2022  10:30 AM         1,629,696 FreeCADBase.dll
07/29/2022  10:28 AM        15,557,120 FreeCADGui.dll
07/28/2022  08:29 PM           102,400 MEFISTO2.dll
07/28/2022  08:31 PM           343,040 NETGENPlugin.dll
07/28/2022  08:28 PM           546,816 SMDS.dll
07/28/2022  08:29 PM         2,591,744 SMESH.dll
07/28/2022  08:28 PM           231,936 SMESHDS.dll
07/28/2022  08:31 PM         2,483,200 StdMeshers.dll
Now I just noticed the Python it is finding is my C:\Python38 , this is a Python 3.8.10 install from python.org. Is this likely the issue?
Post Reply