How to build MQTT Module from Sources under Qt 6.2.3 and MingW on Windows
-
wrote on 18 Feb 2022, 16:33 last edited by
Hi there, i want to build and install the MQWTT Module from the sources. I found a lot of informations in the net, but nothing works.
This is what i have done:
I have downloaded the sources from https://code.qt.io/cgit/qt/qtmqtt.git/, branch 6.2.3 to P:/Qt/qtmqtt
I've created the folder P:/Qt/mqtt/Build and opened a command window there.
Then i started cmake with "cmake .. This happened:-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Could NOT find Qt6WebSockets (missing: Qt6WebSockets_DIR)
CMake Warning at C:/Qt/6.2.3/mingw_64/lib/cmake/Qt6/Qt6Config.cmake:226 (message):
Failed to find Qt component "WebSockets".Expected Config file at
"C:/Qt/6.2.3/mingw_64/lib/cmake/Qt6WebSockets/Qt6WebSocketsConfig.cmake"
does NOT existCall Stack (most recent call first):
CMakeLists.txt:20 (find_package)-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Building for multiple configurations: Debug;Release;MinSizeRel;RelWithDebInfo.
-- Main configuration is: .
-- Check for feature set changes
-- Using installed syncqt found at: C:/Qt/6.2.3/mingw_64/bin/syncqt.pl
-- Running syncqt for module: 'QtMqtt'
-- The following packages have been found:- Qt6BuildInternals (required version >= 6.2.3)
- Qt6CoreTools (required version >= 6.2.3)
- Qt6Core (required version >= 6.2.3)
- Qt6Network (required version >= 6.2.3)
- Qt6QmlTools (required version >= 6.2.3)
- Qt6Quick (required version >= 6.2.3)
- Qt6GuiTools (required version >= 6.2.3)
- Qt6Gui (required version >= 6.2.3)
- Qt6WidgetsTools (required version >= 6.2.3)
- Qt6Widgets (required version >= 6.2.3)
- Qt6 (required version >= 6.2.3)
-- The following OPTIONAL packages have not been found:
- PkgConfig
- Qt6QmlCompilerPlus
- Qt6WebSockets (required version >= 6.2.3)
- Vulkan
- WrapVulkanHeaders
-- Configuring done
-- Generating done
-- Build files have been written to: P:/QT/qtmqtt/buildWhat have i to do now ?
-
wrote on 18 Feb 2022, 19:16 last edited by
Update:
I found one error, there are 2 cmake.exe on my system: one in MSVC, one in MinGW.
Now i'm using the cmake from MinGW, generates this output:
P:\QT\qtmqtt\build>c:\qt\tools\cmake_64\bin\cmake MinGW Makefiles ..
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The CXX compiler identification is MSVC 19.30.30709.0
-- The C compiler identification is MSVC 19.30.30709.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: P:/QT/qtmqtt/build/CMakeFiles/CMakeTmp Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_01ee5.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && Microsoft (R)-Build-Engine, Version 17.0.0+c9eb9dd64 für .NET Framework Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. Microsoft (R) C/C++-Optimierungscompiler Version 19.30.30709 für x64 Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. cl /c /Zi /W1 /WX- /diagnostics:column /O2 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_01ee5.dir\Debug\\" /Fd"cmTC_01ee5.dir\Debug\vc143.pdb" /external:W1 /Gd /TP /errorReport:queue P:\QT\qtmqtt\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx cl : befehlszeile error D8016: Die Befehlszeilenoptionen /O2 und /RTC1 sind inkompatibel. [P:\QT\qtmqtt\build\CMakeFiles\CMakeTmp\cmTC_01ee5.vcxproj]
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
-- Configuring incomplete, errors occurred!
See also "P:/QT/qtmqtt/build/CMakeFiles/CMakeOutput.log".
See also "P:/QT/qtmqtt/build/CMakeFiles/CMakeError.log".CMake is using the wrong compiler, how can i change this ?
-
wrote on 20 Feb 2022, 14:05 last edited by ThirdStrand 8 May 2022, 21:00
Have you tried this from QtCreator? Open the CMakeLists.txt file in QtCreator and check your "Build Steps" configuration in the "Projects" area to include at least the "install" task, then run Build.
This works in MacOS, and I have done this in Windows for 5.15.x where I use MingW 64 bit exclusively.
If you wanted to do this manually, open the terminal window by first opening the project in QtCreator. Right click on the project name in QtCreator and select "Open Terminal with Build Environment" and then run your manual "cmake" steps. Be sure to do a shadow build per normal for cmake so as not to disturb the clean source tree.
-
wrote on 22 Feb 2022, 17:06 last edited by
And also back to the original question>>>>:
What is the accepted method for building modules such as QtMqtt on MacOS and iOS?
CMake is not on the path, so if command line via cmake is the acceptable method, can anyone offer the correct path items to set in the environment before using something such as the
/Users/login/Qt/6.2.3/macos/bin/qt-configure-module
executable as suggested by others (if indeed that is the preferred method).
I have only ever done this is the much simpler to use qmake, and I need some guidance.
-
And also back to the original question>>>>:
What is the accepted method for building modules such as QtMqtt on MacOS and iOS?
CMake is not on the path, so if command line via cmake is the acceptable method, can anyone offer the correct path items to set in the environment before using something such as the
/Users/login/Qt/6.2.3/macos/bin/qt-configure-module
executable as suggested by others (if indeed that is the preferred method).
I have only ever done this is the much simpler to use qmake, and I need some guidance.
@ThirdStrand said in How to build MQTT Module from Sources under Qt 6.2.3 and MingW on Windows:
can anyone offer the correct path items
Did you install CMake? If so how?
-
wrote on 23 Feb 2022, 13:00 last edited by ThirdStrand
CMake was installed by the Qt unified installer for MacOS because it is now required. It does NOT update the system path when it installs (apparently). I have added the export to the .zshrc file I created in my login account.
CMake functions just fine from inside QtCreator, so it manages it's path internally. In the case of MacOS, the QtMqtt module is built properly, it only leaves an artifact of an incorrect path in a few .h files.
In the case of iOS however, it refuses to use the same project to build it, citing the "set to FALSE" error.
1/6