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

Having trouble installing or compiling FreeCAD? Get help here.
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: Building Libs for Windows Debug Version with VS2017/Qt5.12

Post by sgrogan »

wmayer wrote: Mon Mar 25, 2019 6:53 pm to determine the Python version which loads the module FindPythonLibsNew.cmake. Now there it cannot locate PYTHON_LIBRARY and then stops with:
line 150

Code: Select all

            "${_PYTHON_ROOT}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib")
is wrong needs to be "lib" not "libs". This doesn't solve the problem though. PYTHON_LIBRARY_SUFFIX seems to be a problem. Hard coding the path here seems to overcome this problem. Investigating.
"fight the good fight"
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

Due to all the troubles with QtWebkit I had a look at using the QtWebEngine stuff instead. As Manuel has reported it crashes as soon as you load the Start workbench.
With the debug version I got this message:
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
and that it tries to load QtWebEngineProcessD.exe. When I add the line of code and put the executable to the bin directory the messages disappear but FreeCAD still crashes.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

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

Post by apeltauer »

Code: Select all

.....
Found PythonInterp: C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/python.exe (found version "3.7.2") 
Found PythonLibs: optimized;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/libs/python37.lib;debug;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/libs/python37_d.lib (found suitable exact version "3.7.2") 
Boost version: 1.67.0
.....
Shiboken2Config: Using default python: .cp37-win_amd64
Found PythonInterp: C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/python.exe (found suitable version "3.7.2", minimum required is "3") 
Found PythonLibs: optimized;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/libs/Python37.lib;debug;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/libs/python37_d.lib (found suitable version "3.7.2", minimum required is "3") 
SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: 'C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/include'
SHIBOKEN_PYTHON_LIBRARIES computed to value: 'C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/bin/libs/Python37.lib'
libshiboken built for Release
SHIBOKEN_INCLUDE_DIR: C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/Shiboken2-5.12.2/../../../include/shiboken2
SHIBOKEN_LIBRARY: optimized;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/Shiboken2-5.12.2/../../shiboken2.cp37-win_amd64.lib;debug;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/Shiboken2-5.12.2/../../shiboken2_d_d.cp37-win_amd64.lib
PYSIDE_LIBRARY: optimized;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/PySide2-5.12.2/../../pyside2.cp37-win_amd64.lib;debug;C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/lib/cmake/PySide2-5.12.2/../../pyside2_d.cp37-win_amd64_d.lib
PYSIDE_PYTHONPATH: C:/Work/FreeCadLibs/FreeCADLibs_12.1.2_x64_VC15/Lib/site-packages/PySide2
-- matplotlib-3.0.3 has been found.
Platform is 64-bit, set -D_OCC64
git
C:/Work/FreeCAD_GitHub_Apeltauer/bin_release/src/Build/Version.h.out written

area module (for Path Workbench) will be installed to: lib
Configuring done
Generating done
this is my cmake output. "FREECAD_USE_PYBIND11" is enabled.
I try to get the libpack version 12.1.2 to run and upload it again.
Also FEM passes the cmake check. I have added all hdf5 stuff with the med files. But by compiling FreeCAD netgen stuff i get a linking error.
Also i had to adopt some header files. Had to add std:: to all endl commands....
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

But by compiling FreeCAD netgen stuff i get a linking error.
You must look at which functions are missing and then modify the netgen sources by adding the DLL_HEADER export macro.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
In order to debug through the Webengine code I have installed the Qt5.12.1 version and added its bin directory to the PATH before the libpack's bin path. And to my surprise loading the Start workbench suddenly worked. So apparently there must be a difference between the Qt version of the libpack and the installed one.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

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

Post by apeltauer »

wmayer wrote: Tue Mar 26, 2019 8:51 am
But by compiling FreeCAD netgen stuff i get a linking error.
You must look at which functions are missing and then modify the netgen sources by adding the DLL_HEADER export macro.
Thanks for the hint....
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

apeltauer wrote: Tue Mar 26, 2019 7:30 am I try to get the libpack version 12.1.2 to run and upload it again.
Also FEM passes the cmake check. I have added all hdf5 stuff with the med files. But by compiling FreeCAD netgen stuff i get a linking error.
Also i had to adopt some header files. Had to add std:: to all endl commands....
From your Qt installation you should also copy the doc directory to the libpack. The doc directory includes a sub-directory global which includes many qdocconf files. These files are required for the build of QtWebkit.

And you must also copy the resources directory of the Qt installation to the libpack as this provides some files the Webengine requires. Without them it simply crashes. With this configuration I got the Start workbench working now based on the QtWebengine module.
  • Copy the resource directory to the FreeCAD directory
  • Copy the file qt.conf to FreeCAD's bin directory. The content of the file is:

    Code: Select all

    [Paths]
    Prefix=..
    
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

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

Post by apeltauer »

wmayer wrote: Tue Mar 26, 2019 12:34 pm
apeltauer wrote: Tue Mar 26, 2019 7:30 am I try to get the libpack version 12.1.2 to run and upload it again.
Also FEM passes the cmake check. I have added all hdf5 stuff with the med files. But by compiling FreeCAD netgen stuff i get a linking error.
Also i had to adopt some header files. Had to add std:: to all endl commands....
From your Qt installation you should also copy the doc directory to the libpack. The doc directory includes a sub-directory global which includes many qdocconf files. These files are required for the build of QtWebkit.

And you must also copy the resources directory of the Qt installation to the libpack as this provides some files the Webengine requires. Without them it simply crashes. With this configuration I got the Start workbench working now based on the QtWebengine module.
  • Copy the resource directory to the FreeCAD directory
  • Copy the file qt.conf to FreeCAD's bin directory. The content of the file is:

    Code: Select all

    [Paths]
    Prefix=..
    
I have added the files...

Now every time i start the debug version i get the following, same as you already described...
Capture.PNG
Capture.PNG (12.64 KiB) Viewed 1538 times
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

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

Post by apeltauer »

Building with pybind11 the following error i get when building the debug version and only the debug version.

Code: Select all

pyarea.obj : error LNK2019: unresolved external symbol __imp_PyModule_Create2 referenced in function "public: __cdecl pybind11::module::module(char const *,char const *)" (??0module@pybind11@@QEAA@PEBD0@Z)
1>C:\Work\FreeCAD_GitHub_Apeltauer\bin_debug\lib\area_d.pyd : fatal error LNK1120: 1 unresolved externals
1>D
To get there i already had to modify the source code of pybind11. I modified the following:
include\pybind11\detail\common.h line 108

Code: Select all

/// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode
#if defined(_MSC_VER)
#  if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
#    define HAVE_ROUND 1
#  endif
#  pragma warning(push)
#  pragma warning(disable: 4510 4610 4512 4005)
#  if defined(_DEBUG)
#    define PYBIND11_DEBUG_MARKER
#    //undef _DEBUG
#  endif
#endif
see this topic:
https://github.com/pybind/pybind11/issues/1295
https://github.com/pybind/pybind11/issues/1293
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

Another directory that should be copied from Qt is either the complete translation directory but at least qtwebengine_locales because otherwise a warning is raised that the web engine may not work correctly.
Post Reply