[cmake-developers] CMake build with static crt and static QtDialog not linking

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Fri Feb 16 07:43:09 EST 2018


Hello Brad and thank you for your hints!

To get everything working I decided to switch to the same Qt version for now and mimic the kitware-build: 
 - Visual Studio:  2017 (15.5.5)
 - Qt 5.6.3

1) The debug version crashes in

Source/QtDialog/FirstConfigure.cxx:566 

when initializing a const QString. The actual error occurs in QArrayData::deallocate() when ::free() is called. No idea so far what this means.

2) The release version seems to skip the debug error but complains with the message:

>>This application failed to start because it could not find or load the Qt platform plugin "windows" in "".<<

Does anyone know how I can fix this? So far I always only built Qt but never really hacked/fixed anything. I enclose my qtbase/config.summary file for reference.

@brad: could you please provide a config.summary from the kitware Qt-build? Maybe I need to change the windows sdk version or so to fix my problem.

What I checked so far:

a)

The DLL-Dependencies as shown in the Dependency Walker are identical, only IMM32.DLL is missing in my binary. So I think this should be OK.

b)

I'm doing a temporary hack in QtDialog CMakeLists.txt at the moment to link to qtpcre:

set(qt_base_dir "X:/Qt/qt5.6.3Install")
set(qt_lib_dir "${qt_base_dir}/lib")
target_link_libraries(cmake-gui
  "${qt_lib_dir}/qtpcre$<$<CONFIG:Debug>:d>.lib")

Bad but I allows to rebuild/reinstall Qt without having to modify the install directory afterwards.

-----Ursprüngliche Nachricht-----
Von: Brad King [mailto:brad.king at kitware.com] 
Gesendet: Dienstag, 13. Februar 2018 18:11
An: Stuermer, Michael SP/HZA-ZSEP
Cc: cmake-developers at cmake.org
Betreff: Re: [cmake-developers] CMake build with static crt and static QtDialog not linking

On 2/13/2018 11:28 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> I try to do a CMake build with static C runtime and a static Qt 5.10.0

Make sure Qt is configured with both `-static` and `-static-runtime`, and that it is built with the same compiler as CMake.  See the command used below to configure the 64-bit Qt build for the cmake.org binaries.
We use Qt 5.6.3 because it is the last to support Windows XP.

Also, Qt 5.6 doesn't quite set up it's CMake targets correctly when doing a static build.  I had to hack lib/cmake/Qt5Core/Qt5CoreConfig.cmake:

    set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/qtpcre.lib")

> PS: I'm not sure how the mailing list is handled compared to the 
> gitlab instance. Would this be something I should open an issue for?

The mailing list is fine for this.

-Brad

```
call ..\qt-everywhere-opensource-src-5.6.3\configure.bat ^
  -prefix c:/path/to/prefix ^
  -static ^
  -static-runtime ^
  -release ^
  -opensource -confirm-license ^
  -platform win32-msvc2017 ^
  -mp ^
  -gui ^
  -widgets ^
  -qt-pcre ^
  -qt-zlib ^
  -qt-libpng ^
  -qt-libjpeg ^
  -no-gif ^
  -no-icu ^
  -no-pch ^
  -no-sql-sqlite ^
  -no-cetest ^
  -no-angle ^
  -no-opengl ^
  -no-dbus ^
  -no-qml-debug ^
  -no-harfbuzz ^
  -no-accessibility ^
  -skip declarative ^
  -skip multimedia ^
  -skip qtcanvas3d ^
  -skip qtconnectivity ^
  -skip qtdeclarative ^
  -skip qtlocation ^
  -skip qtmultimedia ^
  -skip qtsensors ^
  -skip qtserialport ^
  -skip qtsvg ^
  -skip qtwayland ^
  -skip qtwebchannel ^
  -skip qtwebengine ^
  -skip qtwebsockets ^
  -skip qtwinextras ^
  -skip qtxmlpatterns ^
  -nomake examples -nomake tests
```
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.summary
Type: application/octet-stream
Size: 7653 bytes
Desc: config.summary
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20180216/9774003b/attachment-0001.obj>


More information about the cmake-developers mailing list