FreeCAD debug build with apeltauer's libpack builds release instead

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

--<original problem - the problem changed, see later posts>--

Hi
Big thanks to @apeltauer for new libpack.
Today, I upgraded my toolchain, and I have (after quite a lot of messing around) managed to do a debug build FreeCAD. It had built, but now it just won't run.
I launch it, and it pops up with an error message:

Code: Select all

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
I don't know, how to deal with it. Any clues?

Call stack:

Code: Select all

1  QCoreApplicationPrivate::qmljsDebugArgumentsString                  Qt5Core                                 0x7fff9c308858 
2  QMessageLogger::fatal                                               Qt5Core                                 0x7fff9c306ac1 
3  QGuiApplicationPrivate::init                                        Qt5Gui                                  0x7fff9b2c451d 
4  QGuiApplicationPrivate::createPlatformIntegration                   Qt5Gui                                  0x7fff9b2c219d 
5  QGuiApplicationPrivate::createEventDispatcher                       Qt5Gui                                  0x7fff9b2c1b6b 
6  QCoreApplicationPrivate::init                                       Qt5Core                                 0x7fff9c4a86c2 
7  QGuiApplicationPrivate::init                                        Qt5Gui                                  0x7fff9b2c31cd 
8  QApplicationPrivate::init                                           Qt5Widgets                              0x7fff9c8e3e2f 
9  QApplication::QApplication                                          Qt5Widgets                              0x7fff9c8e011b 
10 Gui::GUIApplicationNativeEventAware::GUIApplicationNativeEventAware GuiApplicationNativeEventAware.cpp 65   0x7fffa64016ac 
11 Gui::GUISingleApplication::GUISingleApplication                     GuiApplication.cpp                 238  0x7fffa63ff82b 
12 Gui::Application::runApplication                                    Application.cpp                    1653 0x7fffa635ada0 
13 image00007ff7_d3340000                                                                                      0x7ff7d33442f7 
14 image00007ff7_d3340000                                                                                      0x7ff7d3345754 
15 image00007ff7_d3340000                                                                                      0x7ff7d3344bda 
16 BaseThreadInitThunk                                                 KERNEL32                                0x7fffeacf7974 
17 RtlUserThreadStart                                                  ntdll                                   0x7fffed79a271 
Microsoft Visual C++ Compiler 16.0.28803.202 (amd64) (AKA MSVC2019, I think)
CMake 3.14.3-win64
libpack 12.1.2
IDE: Qt Creator 4.9.0 Based on Qt 5.12.2 (MSVC 2017, 64 bit)

Also, peculiarly, when I run with debugger, Qt Creator bugs me with an alert that it doesn't look like a debug build. And the executable is named "FreeCAD.exe", not "FreeCAD_d.exe" like it used to be.
Last edited by DeepSOIC on Fri Apr 26, 2019 11:56 pm, edited 2 times in total.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack fails to run

Post by DeepSOIC »

found this:
https://stackoverflow.com/questions/541 ... -initializ
And followed a suggestion to copy <libpack>\bin\Lib\site-packages\PySide2\plugins\platforms to bin (so that paths are bin/platforms/some.dll). Now FreeCAD runs, but looks ugly (like it came from win98 era).

It is indeed a release build, even though I have "debug" build set in cmakecache.txt

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15780 +2 (Git)
Build type: Release
Branch: shapebinder_fix (wrong!! it's FC master)
Hash: 96f927fd97984add46042bf1cb7d594548f57995 (possibly, wrong)
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)
Attachments
build-qt5-ugly.png
build-qt5-ugly.png (123.6 KiB) Viewed 2653 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

Full command line of compiler invocation

Code: Select all

C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1420~1.275\bin\HostX64\x64\cl.exe  /nologo /TP -DBUILD_ADDONMGR -DCMAKE_BUILD_TYPE=\"Release\" -DCOIN_DLL -DFCGui -DFreeCADGui_EXPORTS 
PYSIDE2 -DHAVE_SHIBOKEN2 -DOVR_OS_WIN32 -DQIIS_MAKEDLL -DQSINT_MAKEDLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB -DQT_UITOOLS_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_OCC64 -D_PreComp_ -D_UNICODE -D_USE_3DCONNEXION_SDK -Isrc -IS:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src -I. -IS:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src\Gui -IS:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src\Gui\Quarter -Isrc\Gui -IS:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src\Gui\.. -Isrc\Gui\.. -Isrc\Gui\Language -Isrc\Gui\propertyeditor -Isrc\Gui\TaskView -Isrc\Gui\Quarter -Isrc\Gui\DAGView -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\eigen3 -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\bin\Include -IS:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src\3rdParty\OpenGL\api -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\lib\cmake\Shiboken2-5.12.2\..\..\..\include\shiboken2 -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\lib\cmake\PySide2-5.12.2\..\..\..\include\PySide2 -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\lib\cmake\PySide2-5.12.2\..\..\..\include\PySide2\QtCore -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\lib\cmake\PySide2-5.12.2\..\..\..\include\PySide2\QtGui -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\lib\cmake\PySide2-5.12.2\..\..\..\include\PySide2\QtWidgets -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtCore -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\.\mkspecs\win32-msvc -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtWidgets -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtGui -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtANGLE -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtOpenGL -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtPrintSupport -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtSvg -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtNetwork -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtUiTools -IS:\_vt\dev\PC\Qt\FreeCAD\libpack\12.1.2\include\QtXml /DWIN32 /D_WINDOWS /W3 /GR /EHsc -D_OCC64 /MD /O2 /Ob2 /DNDEBUG /Zm150 /Zi /EHa   /Yu"PreCompiled.h" /FI"S:/_vt/dev/PC/Qt/FreeCAD/build-FreeCAD-ellipse-FC64-ttt/src/Gui/FreeCADGui.pch" /Fp"S:/_vt/dev/PC/Qt/FreeCAD/build-FreeCAD-ellipse-FC64-ttt/src/Gui/FreeCADGui.pch" /showIncludes /Fosrc\Gui\CMakeFiles\FreeCADGui.dir\Splashscreen.cpp.obj /Fdsrc\Gui\CMakeFiles\FreeCADGui.dir\ /FS -c S:\_vt\dev\PC\Qt\FreeCAD\FreeCAD-ellipse\src\Gui\Splashscreen.cpp
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

Also, peculiarly, when I run with debugger, Qt Creator bugs me with an alert that it doesn't look like a debug build. And the executable is named "FreeCAD.exe", not "FreeCAD_d.exe" like it used to be.
Is this a fresh build directory or was it used for your old libpack & toolchain configuration? And are you 100% sure that CMAKE_BUILD_TYPE is set to Debug?
In case you are certain that all the above can be excluded you maybe should try an older CMake version because in the forum some people (including me) had problems with this version. At the moment I use version 3.11 which works flawlessly for me.

Now if all this still doesn't help you can try the following workaround: instead of using nmake, jom or ninja as build system create VisualStudio projects. From the command line you can build the debug version with:

Code: Select all

msbuild FreeCAD_trunk.sln /m /p:Configuration=Debug
And to debug the application just start it and use QtCreator's function to attach its debugger to a running application.
And followed a suggestion to copy <libpack>\bin\Lib\site-packages\PySide2\plugins\platforms to bin (so that paths are bin/platforms/some.dll).
Since Qt5 an application requires one of the available platform plugins. The easiest is to create the sibling directory platforms of the executable and put inside qwindows.dll and qwindowsd.dll.
Now FreeCAD runs, but looks ugly (like it came from win98 era).
This is because Qt requires some more plugins. I cannot tell you exactly which plugin dll is responsible to make the application look nice so I put all the Qt plugin directories into the bin folder.

Btw, in order to use the StartPage you also have to copy QtWebEngineProcess.exe and QtWebEngineProcessd.exe to the bin directory, copy the resources directory (that contains icudtl.dat, ..., qtwebengine_resources_200p.pak) to the parent of the bin directory, copy the translations directory there too and create the file qt.conf inside the bin directory. Its content should be:

Code: Select all

[Paths]
Prefix=..
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

wmayer wrote: Sat Apr 27, 2019 12:36 pm Is this a fresh build directory or was it used for your old libpack & toolchain configuration?
wmayer wrote: Sat Apr 27, 2019 12:36 pm And are you 100% sure that CMAKE_BUILD_TYPE is set to Debug?
Yes, and yes, I have tried starting from scratch twice. In the .ninja file, however, I clearly see build-type="Release" in the header.

It seems like I can debug freecad even in release build, so if I fail to make a debug build, that will still work.


wmayer wrote: Sat Apr 27, 2019 12:36 pm maybe should try an older CMake version because in the forum some people (including me) had problems with this version. At the moment I use version 3.11 which works flawlessly for me.
Will try, I have been using cmake 3.11 previously, but I updated it because of my screwup actually. I had quite a number of screwups in the process. Forgetting to update the source, launching old qt creator that would mess with newer one's compiler settings, pointing Qt creator at a very old cmake are among the most epic.


wmayer wrote: Sat Apr 27, 2019 12:36 pm<more suggestions>
thanks! I don't care about start page, but the suggestion may be very handy for someone who does.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

Yes, and yes, I have tried starting from scratch twice. In the .ninja file, however, I clearly see build-type="Release" in the header.
Did you also use ninja in the past? As far as I remember there are/were some issues with ninja and QtCreator. I use jom and never had problems with it.
It seems like I can debug freecad even in release build, so if I fail to make a debug build, that will still work.
We have added the option to put some minimum debug information also into a release build (see FREECAD_RELEASE_PDB) which can be very helpful to debug a crash on a client's machine and that sends you the crash dump file. However, don't expect too much since usually the content of variables show garbage values.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

wmayer wrote: Sat Apr 27, 2019 1:11 pm Did you also use ninja in the past?
I don't know :oops: , probably not. I don't even know, who is ninja. It was the default. I have tried switching generator to visual studio 2017, 2019 and nmake (in QT Creator's "kit"), but the result was apparently a cmake crash: I get this in qt creator:

Code: Select all

Running "S:\Qt\cmake3-14-3\bin\cmake.exe -E server "--pipe=\\.\pipe\{2d4c5458-6a7f-42ff-aebc-241cb4705692}" --experimental" in S:\_vt\dev\PC\Qt\FreeCAD\build-FreeCAD-ellipse-FC64-ttt.
CMake Project parsing failed.
Parsing of CMake project failed: Connection to CMake server lost.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

Used CMake 3.11.0, generator "NMake makefiles"/Codeblocks this time instead of ninja. With this cmake, it works. But I still get a release build :cry:

Here's CMake output:

Code: Select all

Running "S:\Qt\cmake3110\bin\cmake.exe -E server "--pipe=\\.\pipe\{eae7cda8-e0fc-4e56-8a8d-6a66121ffd15}" --experimental" in S:\_vt\dev\PC\Qt\FreeCAD\build-debug.
Starting to parse CMake project.
Compiler: MSVC, version: 19.20.27508.1
prefix: C:/Program Files (x86)/FreeCAD_trunk
datadir: data
docdir: doc
includedir: include
libdir: lib
cmake: 3.11.0
CMake Warning at CMakeLists.txt:328 (message):
  BUILD_OPENSCAD requires BUILD_MESH_PART;BUILD_DRAFT each be ON, but
  BUILD_MESH_PART is "OFF"
Call Stack (most recent call first):
  CMakeLists.txt:346 (REQUIRES_MODS)


PyCXX found:
  Headers:  S:/_vt/dev/PC/Qt/FreeCAD/FreeCAD-ellipse/src
  Sources:  S:/_vt/dev/PC/Qt/FreeCAD/FreeCAD-ellipse/src/CXX
  Version:  6.2.8
Boost version: 1.67.0
Found the following Boost libraries:
  filesystem
  program_options
  regex
  system
  thread
  chrono
  date_time
  atomic
Found Xerces-C: S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/xerces-c_3.lib
PyCXX found:
  Headers:  S:/_vt/dev/PC/Qt/FreeCAD/FreeCAD-ellipse/src
  Sources:  S:/_vt/dev/PC/Qt/FreeCAD/FreeCAD-ellipse/src/CXX
  Version:  6.2.8
-- Found OCE/OpenCASCADE version: 7.3.0
-- OCE/OpenCASCADE include directory: S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/inc
-- OCE/OpenCASCADE shared libraries directory: S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib
Shiboken2Config: Using default python: .cp36-win_amd64
SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: 'S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/bin/Include'
SHIBOKEN_PYTHON_LIBRARIES computed to value: 'S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/bin/libs/python36.lib'
libshiboken built for Release
SHIBOKEN_INCLUDE_DIR: S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/cmake/Shiboken2-5.12.2/../../../include/shiboken2
SHIBOKEN_LIBRARY: optimized;S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/cmake/Shiboken2-5.12.2/../../shiboken2.cp36-win_amd64.lib;debug;S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/cmake/Shiboken2-5.12.2/../../shiboken2_d_d.cp36-win_amd64.lib
PYSIDE_LIBRARY: optimized;S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/cmake/PySide2-5.12.2/../../pyside2.cp36-win_amd64.lib;debug;S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/lib/cmake/PySide2-5.12.2/../../pyside2_d.cp36-win_amd64_d.lib
PYSIDE_PYTHONPATH: S:/_vt/dev/PC/Qt/FreeCAD/libpack/12.1.2/Lib/site-packages/PySide2
-- matplotlib-3.0.3 has been found.
Platform is 64-bit, set -D_OCC64
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
=======================================
Now run 'make' to build FreeCAD
=======================================

Configuring done
Generating done
CMake Project was parsed successfully.
There is a slightly suspicious line there, "libshiboken built for Release".

See also CMakeCache.txt:
CMakeCache.txt
(41.7 KiB) Downloaded 117 times
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by apeltauer »

Sorry for the question, but why dont you use visual studio?
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

apeltauer wrote: Thu May 02, 2019 5:03 am Sorry for the question, but why dont you use visual studio?
  1. You need to activate it after the trial period and therefore need a MS account which not everybody wants to do
  2. VS takes another couple of GB on your HD while QtCreator needs << 500 MB
  3. IntelliSense in QtCreator works much better than in VS -- at least compared to older versions of VS
Post Reply