Building Libs for Windows Debug Version with VS2017/Qt5.12

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
zach
Posts: 28
Joined: Thu Apr 04, 2019 4:56 pm
Location: Texas

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby zach » Sun Jul 14, 2019 2:05 am

wmayer wrote:
Sat Jul 13, 2019 10:19 pm
Does your libpack have the file python36.zip as shown in the error message?
It does not. However, checking the FREECAD_COPY_LIBPACK_BIN_TO_BUILD option in CMake causes FreeCAD run normally.
GSoC FreeCAD Blog: zachgummow.github.io
User avatar
sgrogan
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Tue Jul 16, 2019 8:47 pm

wmayer wrote:
Sat Jul 13, 2019 10:19 pm
Does your libpack have the file python36.zip as shown in the error message?
This is not included in the 12.1.2 lib pack of apeltauer.
Should it be?
For me starting FreeCAD with a similar .bat I see this in the log

Code: Select all

Log: PATH = C:\Users\Chris\Miniconda3\Library\bin;C:\Users\Chris\Downloads\FreeCADLibs_12.1.2_x64_VC15\bin;

Code: Select all

Log: PythonSearchPath = C:\Users\Chris\Downloads\FreeCADLibs_12.1.2_x64_VC15\bin\python36.zip;C:\Users\Chris\Miniconda3\Lib;C:\Users\Chris\Miniconda3\DLLs;C:\Users\Chris\GitHub\FreeCAD-zach\bin
For me FreeCAD starts, but I get a bunch of Pyside2 errors, I guess because the site-packages directory is not in the PythonSearchPath.
I don't see any ENV variables that would have my Miniconda3 python to be prepended to the PATH created in the .bat file?
Any hints appreciated.
wmayer
Site Admin
Posts: 14423
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Wed Jul 17, 2019 11:37 am

This is not included in the 12.1.2 lib pack of apeltauer.
Should it be?
I don't know how others do it but for me FreeCAD crashes immediately as soon as it tries to initialize Python because it cannot find modules like os.py. I don't know why it fails to load the file from Python's Lib directory. Maybe the others copy this directory to FreeCAD's bin directory.

What works for me is creating the files python36.zip and python36_d.zip whose content is everything underneath Python's Lib directory but without the site-packages stuff because Python cannot load extension modules from a zip file anyway (at least in the past) and put them into the LibPack's bin directory.
For me FreeCAD starts, but I get a bunch of Pyside2 errors, I guess because the site-packages directory is not in the PythonSearchPath.
Check sys.path. If it doesn't include the site-package then it won't load PySide2.

My PythonSearchPath doesn't contain site-packages either and I don't know if at this point it's the same as sys.path or if sys.path gets extended afterwards.
User avatar
sgrogan
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Wed Jul 17, 2019 9:52 pm

wmayer wrote:
Wed Jul 17, 2019 11:37 am
I don't know how others do it
Thanks for the very useful information!
As part of this I need to copy QtWebEngineProcess.exe and qt.conf to the build/bin dir. If everyone sees this I think zack should make a pull request to add these files to FREECAD_COPY_BUILD_DIRS_TO_BUILD as part of his GSoC project.

I found on the Python site that there is an "embeddable" download that includes the python36.zip https://www.python.org/downloads/release/python-368/ An interesting thing for this package is that the python source files(.py) are removed and the compiled (.pyc) files are present. I guess this should speed up loading time? I haven't tested this yet, I've added a python36.zip made from the 12.1.2 libpack as you suggested.

I think we should;
1. add python36(_d).zip to the libpack
2. copy QtWebEngineProcess.exe and qt.conf to the build/bin dir as part of FREECAD_COPY_BUILD_DIRS_TO_BUILD
3. create the .bat file as part of FREECAD_COPY_BUILD_DIRS_TO_BUILD

I guess 3 is open for debate?
apeltauer wrote:ping
User avatar
apeltauer
Posts: 198
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Thu Jul 18, 2019 6:20 am

wmayer wrote:
Wed Jul 17, 2019 11:37 am
What works for me is creating the files python36.zip and python36_d.zip whose content is everything underneath Python's Lib directory but without the site-packages stuff because Python cannot load extension modules from a zip file anyway (at least in the past) and put them into the LibPack's bin directory.
I can create the the python zip files like werner mentioned. Is this ok?
User avatar
sgrogan
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Thu Jul 18, 2019 10:47 am

apeltauer wrote:
Thu Jul 18, 2019 6:20 am
I can create the the python zip files like werner mentioned. Is this ok?
I think we should use the one from the official embeddable version. With only the .pyc files the archive is a bit smaller.
I will post the archive here tonight my time.
User avatar
apeltauer
Posts: 198
Joined: Fri Aug 11, 2017 2:19 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby apeltauer » Thu Jul 18, 2019 11:45 am

If the official works then we can go with it. But keep in mind, i have compiled python on my machine. But i should have used the default configuration for building python...
wmayer
Site Admin
Posts: 14423
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Thu Jul 18, 2019 12:48 pm

sgrogan wrote:
Wed Jul 17, 2019 9:52 pm
wmayer wrote:
Wed Jul 17, 2019 11:37 am
I don't know how others do it
Thanks for the very useful information!
As part of this I need to copy QtWebEngineProcess.exe and qt.conf to the build/bin dir. If everyone sees this I think zack should make a pull request to add these files to FREECAD_COPY_BUILD_DIRS_TO_BUILD as part of his GSoC project.
Yes, it also annoys me to always copy these files manually when making a complete fresh build. I have this on my to-do list.
sgrogan wrote:
Wed Jul 17, 2019 9:52 pm
I found on the Python site that there is an "embeddable" download that includes the python36.zip https://www.python.org/downloads/release/python-368/ An interesting thing for this package is that the python source files(.py) are removed and the compiled (.pyc) files are present. I guess this should speed up loading time? I haven't tested this yet, I've added a python36.zip made from the 12.1.2 libpack as you suggested.
Very likely. When you import a Python module then you will see that the interpreter creates a .pyc file.
sgrogan wrote:
Wed Jul 17, 2019 9:52 pm
I think we should;
1. add python36(_d).zip to the libpack
2. copy QtWebEngineProcess.exe and qt.conf to the build/bin dir as part of FREECAD_COPY_BUILD_DIRS_TO_BUILD
3. create the .bat file as part of FREECAD_COPY_BUILD_DIRS_TO_BUILD

I guess 3 is open for debate?
I will have a look at this soon.
User avatar
sgrogan
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Thu Jul 18, 2019 8:42 pm

apeltauer wrote:
Thu Jul 18, 2019 11:45 am
If the official works then we can go with it. But keep in mind, i have compiled python on my machine. But i should have used the default configuration for building python...
The official one works and is much smaller, because it only contains the .pyc files. For me it was 2+MB vs 190+MB
The debug version is just a re-named version of the release version.
I also uploaded ocl.pyd, I don't have a debug version yet.
https://github.com/sgrogan/FreeCAD/rele ... bpack-0.19
User avatar
sgrogan
Posts: 5201
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Thu Jul 18, 2019 8:44 pm

wmayer wrote:
Thu Jul 18, 2019 12:48 pm
I will have a look at this soon.
zach is working on this. see here: https://forum.freecadweb.org/viewtopic.php?f=4&t=37807