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

2018-02-20 Thread Egor Pugin
Hi Michael,

Be aware of VS2017 issues with variables initialization during static
build (in Qt in particular).

See for more info:
https://developercommunity.visualstudio.com/content/problem/76198/vs-2017-compiler-creates-broken-debug-build-using.html
https://bugreports.qt.io/browse/QTBUG-66140

Sorry for the late reply.

-- 
Egor Pugin
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


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

2018-02-16 Thread Stuermer, Michael SP/HZA-ZSEP
> 
> On 2/16/2018 7:43 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> > 1) The debug version crashes in
> 
> I don't know if we've ever built a debug configuration against this Qt.
> 
> > This application failed to start because it could not find or load the
> > Qt platform plugin "windows" in "".
> 
> We statically link that plugin.  See our release build settings here:
> 
>   https://gitlab.kitware.com/cmake/cmake/blob/v3.11.0-
> rc1/Utilities/Release/win64_release.cmake
> 

Thanks for this hint, now it crashes in debug when loading the plugin, but 
it works well for release. So I guess it's fine for now.

I'll investigate this a bit further and come back here if I find some solutions 
for the debug crashes or get later Qt versions working as well.

> In particular, CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES
> in the initial cache file configures use of the static plugin.
> 
> > @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.
> 
> We use a custom environment to use the VS 2017 toolchain but still support
> Windows XP:
> 
> ```
> Environment:
> INCLUDE=
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include
>   C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
>   c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include
> LIB=
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\lib\x64
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\lib\x64
>   C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64
>   c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\lib\x64
> PATH=
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64
>   C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\MSBuild\15.0\bin
>   C:\Windows\Microsoft.NET\Framework64\v4.0.30319
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\Common7\IDE
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Professional\Common7\Tools
>   C:\Windows\system32
>   C:\Windows
> Configuration:
> pcre
> release
> compile_examples
> msvc_mp
> Qt Configuration:
> minimal-config
> small-config
> medium-config
> large-config
> full-config
> release
> static
> static_runtime
> zlib
> no-gif
> jpeg
> png
> freetype
> audio-backend
> no-qml-debug
> directwrite
> native-gestures
> qpa
> concurrent
> 
> QMAKESPEC...win32-msvc2017 (commandline)
> Architecturex86_64, features: sse sse2 Host
> Architecture...x86_64, features: sse sse2 
> Maketoolnmake
> Debug...no Force debug infono
> C++ language standard...auto
> Link Time Code Generation...no
> Using PCH ..no
> Accessibility support...no
> RTTI supportyes
> SSE2 supportyes
> SSE3 supportyes
> SSSE3 support...yes
> SSE4.1 support..yes
> SSE4.2 support..yes
> AVX support.yes
> AVX2 supportyes
> NEON supportno
> OpenGL support..no
> Large File support..yes
> NIS support.no
> Iconv support...no
> Evdev support...no
> Mtdev support...no
> Inotify support.no
> eventfd(7) support..no
> Glib supportno
> CUPS supportno
> OpenVG support..no
> SSL support.no
> OpenSSL support.no
> libproxy supportno
> Qt D-Bus supportno
> Qt Widgets module support...yes
> Qt GUI module support...yes
> QML debugging...no
> DirectWrite support.yes
> Use system proxies..no
> 
> QPA Backends:
> GDI.yes
> Direct2Dno
> 
> Third Party Libraries:
> ZLIB supportqt
> GIF support.no
> JPEG supportyes
> PNG support.yes
> FreeType supportyes
> Fontconfig support..no
> HarfBuzz supportno
> PCRE supportqt
> ICU support.no
> ANGLE...no
> Dynamic OpenGL..no
> 
> Styles:
> Windows.yes
> Windows XP..yes
> Windows Vista...yes
> Fusion..yes
> Windows CE..no
> Windows Mobile..no
> 
> Sql 

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

2018-02-16 Thread Brad King
On 2/16/2018 7:43 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> 1) The debug version crashes in

I don't know if we've ever built a debug configuration against this Qt.

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

We statically link that plugin.  See our release build settings here:

  
https://gitlab.kitware.com/cmake/cmake/blob/v3.11.0-rc1/Utilities/Release/win64_release.cmake

In particular, CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES
in the initial cache file configures use of the static plugin.

> @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.

We use a custom environment to use the VS 2017 toolchain but still
support Windows XP:

```
Environment:
INCLUDE=
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include
  C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
  c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include
LIB=
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\lib\x64
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\lib\x64
  C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64
  c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\lib\x64
PATH=
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64
  C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\MSBuild\15.0\bin
  C:\Windows\Microsoft.NET\Framework64\v4.0.30319
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\Common7\IDE
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\Common7\Tools
  C:\Windows\system32
  C:\Windows
Configuration:
pcre
release
compile_examples
msvc_mp
Qt Configuration:
minimal-config
small-config
medium-config
large-config
full-config
release
static
static_runtime
zlib
no-gif
jpeg
png
freetype
audio-backend
no-qml-debug
directwrite
native-gestures
qpa
concurrent

QMAKESPEC...win32-msvc2017 (commandline)
Architecturex86_64, features: sse sse2
Host Architecture...x86_64, features: sse sse2
Maketoolnmake
Debug...no
Force debug infono
C++ language standard...auto
Link Time Code Generation...no
Using PCH ..no
Accessibility support...no
RTTI supportyes
SSE2 supportyes
SSE3 supportyes
SSSE3 support...yes
SSE4.1 support..yes
SSE4.2 support..yes
AVX support.yes
AVX2 supportyes
NEON supportno
OpenGL support..no
Large File support..yes
NIS support.no
Iconv support...no
Evdev support...no
Mtdev support...no
Inotify support.no
eventfd(7) support..no
Glib supportno
CUPS supportno
OpenVG support..no
SSL support.no
OpenSSL support.no
libproxy supportno
Qt D-Bus supportno
Qt Widgets module support...yes
Qt GUI module support...yes
QML debugging...no
DirectWrite support.yes
Use system proxies..no

QPA Backends:
GDI.yes
Direct2Dno

Third Party Libraries:
ZLIB supportqt
GIF support.no
JPEG supportyes
PNG support.yes
FreeType supportyes
Fontconfig support..no
HarfBuzz supportno
PCRE supportqt
ICU support.no
ANGLE...no
Dynamic OpenGL..no

Styles:
Windows.yes
Windows XP..yes
Windows Vista...yes
Fusion..yes
Windows CE..no
Windows Mobile..no

Sql Drivers:
ODBCno
MySQL...no
OCI.no
PostgreSQL..no
TDS.no
DB2.no
SQLite..no (qt)
SQLite2.no
InterBase...no
```

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

That's due to the static library dependencies problem I mentioned previously.
See my earlier message about hacking _Qt5Core_LIB_DEPENDENCIES in Qt's files.

-Brad
-- 

Powered by 

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

2018-02-16 Thread Stuermer, Michael SP/HZA-ZSEP
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$<$: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.k...@kitware.com] 
Gesendet: Dienstag, 13. Februar 2018 18:11
An: Stuermer, Michael SP/HZA-ZSEP
Cc: cmake-developers@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
```


config.summary
Description: config.summary
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


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

2018-02-13 Thread David Cole via cmake-developers
I had a project where I had to do this in the main.cpp file to get it
to link with static Qt on Windows:

#ifdef _WIN32
#ifdef QT_STATIC
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#endif
#endif

Those unresolved externals you posted look familiar... Does this fix it?


HTH,
David C.

On Tue, Feb 13, 2018 at 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 build
> to avoid runtime errors when giving the binaries to colleagues. The Visual
> Studio version is 2017. AFAIK the official CMake builds already use this
> “full-static-build” scheme. However I end up with some linking errors of 137
> unresolved external symbols starting with
>
>
>
> unresolved external symbol __imp_OpenThemeData referenced in function
> "public: virtual void __cdecl QVistaBackButton::paintEvent
>
>
>
> and ending with
>
>
>
> unresolved external symbol NetApiBufferFree referenced in function "public:
> static bool __cdecl QFileSystemEngine::uncListSharesOnServer
>
>
>
> Are there some tricks I have to do to get this working? I changed all /MD
> flags manually to /MT, but nothing else so far.
>
>
>
> 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? I personally
> do not see it as an issue (which means “something has to be changed in the
> code” for me). Or is the mailing list more or less a leftover from
> before-gitlab times?
>
>
>
> Best regards,
>
> Michael
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake-developers
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


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

2018-02-13 Thread Brad King
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
```
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


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

2018-02-13 Thread Stuermer, Michael SP/HZA-ZSEP
I try to do a CMake build with static C runtime and a static Qt 5.10.0 build to 
avoid runtime errors when giving the binaries to colleagues. The Visual Studio 
version is 2017. AFAIK the official CMake builds already use this 
"full-static-build" scheme. However I end up with some linking errors of 137 
unresolved external symbols starting with

unresolved external symbol __imp_OpenThemeData referenced in function "public: 
virtual void __cdecl QVistaBackButton::paintEvent

and ending with

unresolved external symbol NetApiBufferFree referenced in function "public: 
static bool __cdecl QFileSystemEngine::uncListSharesOnServer

Are there some tricks I have to do to get this working? I changed all /MD flags 
manually to /MT, but nothing else so far.

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? I personally do 
not see it as an issue (which means "something has to be changed in the code" 
for me). Or is the mailing list more or less a leftover from before-gitlab 
times?

Best regards,
Michael

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers