Open BLumia opened 5 months ago
Related to QT_QPA_DEFAULT_PLATFORM
, I checked my local files, there is a file named QtBuildInternalsExtra.cmake
which contains a line: set(QT_QPA_DEFAULT_PLATFORM "windows" CACHE STRING "")
in MSYS2's qt package and Qt's official package (installed via its maintainance tool). I didn't find this file in my Conan 2 installation. I guess this might be the source of the issue?
I'm not sure if it is related, but even when linking against Qt 6.7.1 with shared=True
, I get a slew of 20 or so warnings like:
CMake Warning at /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3459 (message):
The qml plugin 'qtquick2plugin' is a dependency of 'myapp', but the link
target it defines (Qt6::qtquick2plugin) does not exist in the current
scope. The plugin will not be linked.
Call Stack (most recent call first):
/opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:678 (qt6_import_qml_plugins)
/opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:678 (cmake_language)
/opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:774 (_qt_internal_finalize_executable)
/opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:590:EVAL:1 (qt6_finalize_target)
app/myapp/CMakeLists.txt:DEFERRED
Is this to be expected?
Description
When trying to static link Qt 6.7.0 using conan 2, the Qt integration plugin won't get linked automatically (https://github.com/conan-io/conan-center-index/issues/23045). As a workaround, developers need to use the Qt plugins manually. Qt's
qt_import_plugins()
CMake macro can be used for this purpose, but it won't work.Additional info:
The
QT_DEFAULT_PLUGIN
cmake target property will be set for Qt modules internally, if it is set, that module then should be linked automatically when building a static program. So developers actually won't need to useqt_import_plugins()
to link basic platform plugins manually. I attempt to do that only because of https://github.com/conan-io/conan-center-index/issues/23045.Related to how the
QT_DEFAULT_PLUGIN
thing works, please simply searchQT_DEFAULT_PLUGIN
as keyword inqtbase
source code. For a list of modules was set as default, see https://github.com/search?q=repo%3Aqt%2Fqtbase+DEFAULT_IF&type=code . And according to the source, the Windows platform plugin should be treated as default as long asQT_QPA_DEFAULT_PLATFORM
is correct.Package and Environment Details
Conan profile
conan profile show default
(is this a comamnd for conan 1?): conan profile: error: unrecognized arguments: default ERROR: Exiting with code: 2conan profile show
: Host profile: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=WindowsBuild profile: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows
Steps to reproduce
A minimized project to test:
CMakeLists.txt
main.cpp
conanfile.txt (note: the
qt*:qttools=True
option is not actually needed, I simply want to avoid a Qt rebuild on my local PC)Logs
Click to expand log
NOTE: - The project path is under `C:\msys64\` but it’s **not** using MSYS2 or gcc. I am using MSVC to build. - The following log contains Chinese text since I don't know how to override MSVC's output language. ``` PS C:\msys64\home\Gary\Source\qt-conan2-test> conan install . --build=missing ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: C:\msys64\home\Gary\Source\qt-conan2-test\conanfile.txt Requirements brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60 - Cache freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498 - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e - Cache harfbuzz/8.3.0#11ea382783bd0b36e975cbd5f397c515 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache libpng/1.6.42#fdba4ebf89df3c55d6db0145a2a66a24 - Cache libpq/15.4#cbae5e1ee85bd5e959e039e00307e8b1 - Cache md4c/0.4.8#02b5e5d8640a6ef9fbd663134edfa1e4 - Cache openssl/3.2.1#edbeabd3bfc383d2cca3858aa2a78a0d - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache qt/6.7.0#c351e40b526c9ba427de9c595ba8e169 - Cache sqlite3/3.45.0#3a7911478ffd14e7acc694ac113449b6 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Build requirements autoconf/2.71#00a1e46d8ba5baaf7f10d64c1a6a0342 - Cache automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache cmake/3.28.1#92f79424d7b65b12a84a2180866c3a78 - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache meson/1.3.2#d1125ba555ec1a94f165a3412fdf7f88 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache nasm/2.15.05#058c93b2214a49ca1cfe9f8f26205568 - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache strawberryperl/5.32.1.1#8f83d05a60363a422f9033e52d106b47 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Resolved version ranges cmake/[>=3.21.1 <4]: cmake/3.28.1 openssl/[>=1.1 <4]: openssl/3.2.1 zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== double-conversion/3.3.0: Checking 3 compatible configurations double-conversion/3.3.0: Main binary package 'dee9f7f985eb1c20e3c41afaa8c35e2a34b5ae0b' missing. Using compatible package '9bdee485ef71c14ac5f8a657202632bdb8b4482b': compiler.cppstd=14 harfbuzz/8.3.0: Checking 3 compatible configurations harfbuzz/8.3.0: Main binary package '8fbd9852939dc7e20c4d104535197ca570958532' missing. Using compatible package '94203641fd48e51e6df556cb251ad960ea97eac7': compiler.cppstd=14 Requirements brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:75df3523cadfb3cb5a2c1cc2d61e8c640e1f9b96#249943a2756eb869cac284274651a4ab - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60:9bdee485ef71c14ac5f8a657202632bdb8b4482b#2676cc725a3e2249b2b2811c48133298 - Cache freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498:79f73b3fcb4ea3718b05e96b46594ae8f2ec3895#53ac03e5c3488bf755141e39b85d381d - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e:750e9c8cf560085c96c0fa42531c45c18af8be50#5abe8ed5a20dd7e5644d0a08f20895db - Cache harfbuzz/8.3.0#11ea382783bd0b36e975cbd5f397c515:94203641fd48e51e6df556cb251ad960ea97eac7#7107306b6fe48c817deff14ea2cc9662 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916:7bfde258ff4f62f75668d0896dbddedaa7480a0f#37e6c892e9418389fcf21227e9c1ae6b - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b:55052839d1d508208c0cd4c7594a7001c70287d1#bea6a5629dc31a80b4d489e5ef163ec4 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7bfde258ff4f62f75668d0896dbddedaa7480a0f#9ef92719f5c05dca2f0dbb46f50d3f8d - Cache libpng/1.6.42#fdba4ebf89df3c55d6db0145a2a66a24:e0d2306461d10438fbd847f0556a0f0ac5653d3a#f9561a82539b5d98122ac38db2260171 - Cache libpq/15.4#cbae5e1ee85bd5e959e039e00307e8b1:05bf1a61df8ad420b533b8f994d863f4ee516906#43cc14c9dac5d3e89d6e661935452ce7 - Cache md4c/0.4.8#02b5e5d8640a6ef9fbd663134edfa1e4:f55a78cc20dfe61b6b25458bc1b7e17f987b7176#477adbf3b1fc244560cfc07ac0024d4e - Cache openssl/3.2.1#edbeabd3bfc383d2cca3858aa2a78a0d:2bcf959ecd653496ee2aa793e11b67c013b3b876#ce119c83db4f9442029a7ed7cc5f52e4 - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#d6a7c0162d1450645a9d56832ca25ae6 - Cache qt/6.7.0#c351e40b526c9ba427de9c595ba8e169:e6e1fd07d11397fa45b5ddf46efe66b6191b47b8#4cee36bd0c1a80dba9260493e10fa566 - Cache sqlite3/3.45.0#3a7911478ffd14e7acc694ac113449b6:2390fed5d13307e3b6e2379eb01b1a4af6af2f1c#1679ee42048da5ac55924afbdc0ecd31 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache Build requirements Skipped binaries autoconf/2.71, automake/1.16.5, bzip2/1.0.8, cmake/3.28.1, glib/2.78.1, libffi/3.4.4, libgettext/0.22, libiconv/1.17, m4/1.4.19, meson/1.2.2, meson/1.3.2, msys2/cci.latest, nasm/2.15.05, ninja/1.11.1, pcre2/10.42, pkgconf/2.0.3, pkgconf/2.1.0, strawberryperl/5.32.1.1, zlib/1.3.1 ======== Installing packages ======== brotli/1.1.0: Already installed! (1 of 17) bzip2/1.0.8: Already installed! (2 of 17) double-conversion/3.3.0: Already installed! (3 of 17) md4c/0.4.8: Already installed! (4 of 17) sqlite3/3.45.0: Already installed! (5 of 17) zlib/1.3.1: Already installed! (6 of 17) libiconv/1.17: Already installed! (7 of 17) libpq/15.4: Already installed! (8 of 17) libffi/3.4.4: Already installed! (9 of 17) libpng/1.6.42: Already installed! (10 of 17) pcre2/10.42: Already installed! (11 of 17) pcre2/10.42: Appending PATH environment variable: C:\Users\Gary\.conan2\p\pcre2e09694aa47719\p\bin openssl/3.2.1: Already installed! (12 of 17) libgettext/0.22: Already installed! (13 of 17) freetype/2.13.2: Already installed! (14 of 17) glib/2.78.1: Already installed! (15 of 17) harfbuzz/8.3.0: Already installed! (16 of 17) qt/6.7.0: Already installed! (17 of 17) WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: libgettext/0.22, sqlite3/3.45.0, libpq/15.4, libpng/1.6.42, bzip2/1.0.8, freetype/2.13.2, brotli/1.1.0, openssl/3.2.1, pcre2/10.42, libiconv/1.17, md4c/0.4.8, zlib/1.3.1, qt/6.7.0 WARN: deprecated: 'cpp_info.build_modules' used in: sqlite3/3.45.0, bzip2/1.0.8, freetype/2.13.2, openssl/3.2.1, qt/6.7.0 WARN: deprecated: 'env_info' used in: sqlite3/3.45.0, bzip2/1.0.8, freetype/2.13.2, openssl/3.2.1, pcre2/10.42, libiconv/1.17, md4c/0.4.8, libpq/15.4, glib/2.78.1 WARN: deprecated: 'cpp_info.filenames' used in: sqlite3/3.45.0, freetype/2.13.2 WARN: deprecated: 'user_info' used in: freetype/2.13.2 ======== Finalizing install (deploy, generators) ======== conanfile.txt: Writing generators to C:\msys64\home\Gary\Source\qt-conan2-test\build\generators conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(Qt6) target_link_libraries(... qt::qt) conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23 conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake