Skip to content

[Linux] Static Qt6 Dependency error building with cmake+vcpkg #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mateoconlechuga opened this issue Feb 16, 2025 · 6 comments
Open
Labels
build external issue About something beyond our (direct) control OS:Linux

Comments

@mateoconlechuga
Copy link
Member

mateoconlechuga commented Feb 16, 2025

It doesn't build and nothing works

While building Qt (?) with cmake+vcpkg:


qtsvg provides CMake targets:
--
2 |  
3 | # this is heuristically generated, and may not be correct
4 | find_package(Qt6Svg CONFIG REQUIRED)
5 | target_link_libraries(main PRIVATE Qt::Svg Qt6::Svg Qt::SvgPrivate Qt6::SvgPrivate)
6 |  
7 | find_package(Qt6SvgWidgets CONFIG REQUIRED)
8 | target_link_libraries(main PRIVATE Qt::SvgWidgets Qt6::SvgWidgets Qt::SvgWidgetsPrivate Qt6::SvgWidgetsPrivate)
9 |  
10 | -- Running vcpkg install - done
11 | -- Detected system: Linux - host processor: x86_64 - CXX_COMPILER: GNU
12 | -- Using system ZLIB.
13 | -- Using system PCRE2.
14 | -- Using system PNG.
15 | -- Using system Freetype.
16 | -- Checking for module 'xkbcommon-x11>=0.4.1'
17 | --   Package 'xkbcommon-x11' not found
18 | CMake Warning at /home/hew/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
19 | Found package configuration file:
20 |  
21 | /home/hew/projects/cemu/gui/qt/CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6XcbQpaPrivate/Qt6XcbQpaPrivateConfig.cmake
22 |  
23 | but it set Qt6XcbQpaPrivate_FOUND to FALSE so package "Qt6XcbQpaPrivate" is
24 | considered to be NOT FOUND.  Reason given by package:
25 |  
26 | Qt6XcbQpaPrivate could not be found because dependency XKB_COMMON_X11 could
27 | not be found.
28 |  
29 | Configuring with --debug-find-pkg=XKB_COMMON_X11 might reveal details why
30 | the package was not found.
31 |  
32 | Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
33 | of the path variables that find_package uses to try and find the package.
34 |  
35 | Call Stack (most recent call first):
36 | /home/hew/tools/cmake-3.31.5-linux-x86_64/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
37 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6/QtPublicDependencyHelpers.cmake:111 (find_dependency)
38 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6QXcbIntegrationPluginDependencies.cmake:15 (_qt_internal_find_qt_dependencies)
39 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6QXcbIntegrationPluginConfig.cmake:48 (include)
40 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6/QtPublicPluginHelpers.cmake:518 (include)
41 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6GuiPlugins.cmake:5 (__qt_internal_include_plugin_packages)
42 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6GuiConfig.cmake:125 (include)
43 | /home/hew/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
44 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6/Qt6Config.cmake:164 (find_package)
45 | /home/hew/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
46 | CMakeLists.txt:91 (find_package)
47 |  
48 |  
49 | Binary dir: /home/hew/projects/cemu/gui/qt/CEmu.build/Linux-x64-Qt6
50 | CMake Warning (dev) at CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Core/Qt6CoreMacros.cmake:3122 (message):
51 | The FILENAME_VARIABLE keyword is deprecated and will be removed soon.
52 | Please use OUTPUT_SCRIPT instead.
53 | Call Stack (most recent call first):
54 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Core/Qt6CoreMacros.cmake:3219 (qt6_generate_deploy_app_script)
55 | CMakeLists.txt:381 (qt_generate_deploy_app_script)
56 | This warning is for project developers.  Use -Wno-dev to suppress it.
57 |  
58 | -- Configuring done (1.2s)
59 | CMake Error at CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6QXcbIntegrationPluginTargets.cmake:60 (set_target_properties):
60 | The link interface of target "Qt6::QXcbIntegrationPlugin" contains:
61 |  
62 | Qt6::XcbQpaPrivate
63 |  
64 | but the target was not found.  Possible reasons include:
65 |  
66 | * There is a typo in the target name.
67 | * A find_package call is missing for an IMPORTED target.
68 | * An ALIAS target is missing.
69 |  
70 | Call Stack (most recent call first):
71 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6QXcbIntegrationPluginConfig.cmake:51 (include)
72 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6/QtPublicPluginHelpers.cmake:518 (include)
73 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6GuiPlugins.cmake:5 (__qt_internal_include_plugin_packages)
74 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6Gui/Qt6GuiConfig.cmake:125 (include)
75 | /home/hew/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
76 | CEmu.build/Linux-x64-Qt6/vcpkg_installed/x64-linux-release/share/Qt6/Qt6Config.cmake:164 (find_package)
77 | /home/hew/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
78 | CMakeLists.txt:91 (find_package)
79 |  
80 |  
81 | -- Generating done (0.0s)
82 | CMake Generate step failed.  Build files cannot be regenerated correctly.

@adriweb adriweb added external issue About something beyond our (direct) control build OS:Linux labels Feb 16, 2025
@adriweb
Copy link
Member

adriweb commented Feb 16, 2025

(note: on mateo's set up, anyway, since CI is happy, and on personal builds it's also fine: macOS (clion with cmake+vcpkg (adriweb)) and windows too (VS with cmake+vcpkg (calc84))

I'm trying a fresh Ubuntu VM to see if I can repro

@debrouxl
Copy link
Collaborator

I know that it was a joke and that pieces of information were available elsewhere to other maintainers, but the first version of your bug report was begging for a "you suck at making actionable bug reports" response, dear Mateo ;)

@adriweb
Copy link
Member

adriweb commented Feb 16, 2025

Gotta make the title clickbaity 👀

@adriweb adriweb changed the title This project sucks [Linux] Dependency error building with cmake+vcpkg Feb 16, 2025
@adriweb
Copy link
Member

adriweb commented Feb 16, 2025

I basically repro'd the issue on a fresh Ubuntu 24.10 VM.

I'll try investigating that a bit more before trying with a config closer to the CI (same vcpkg commits and all that)

@adriweb
Copy link
Member

adriweb commented Feb 17, 2025

So far no luck, even after having checked out an older vcpkg. I'm not sure why qt's cmake stuff can't find the xcb lib, whether host or vcpkg-provided... especially when there's no such problem in CI.

Building in Dynamic seems to be OK, as long as you end up providing the xcb qt plugin later... but that's not solving the issue.

@adriweb adriweb changed the title [Linux] Dependency error building with cmake+vcpkg [Linux] Static Qt6 Dependency error building with cmake+vcpkg Feb 17, 2025
@adriweb
Copy link
Member

adriweb commented Feb 17, 2025

So... in conclusion, where it works fine on macOS and Windows, something is weird on Linux in some setups (at least on a fresh Ubuntu 24.10 VM, I guess I can try on another distro but even the Ubuntu CI works for unknown reasons), for the Static Qt6 build of CEmu (the default!) within vcpkg from cmake: it fails to find xkbconfig-x11, which ends up as a required dependency for the "xcb" qt platform plugin.

For now, if you want to build on Linux:

  • With cmake+vcpkg:
    • either choose the preset for Qt5 (static or dynamic), see below
    • or choose the preset for Qt6 dynamic (you may have to remove (from vcpkg.json) and later runtime-provide, the xcb lib)
  • With just cmake: as long as you have the deps installed, it should be fine as usual
  • Without cmake (but qmake the .pro file): as long as you have the deps installed, it should be fine as usual

If anyone wants to dive deeper than Mateo and I did, feel free to do so, as this is becoming a mystery, especially when it works in CI!


In the meantime, I've added the Linux Qt5 presets for cmake+vcpkg in b3821a5.
So, you can do this to get something that works until the Qt6 situation is solved:

cmake -G Ninja --preset Linux-x64-Qt5 -DDEPS_RELEASE_ONLY=ON
cmake --build --preset Linux-x64-Qt5-Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build external issue About something beyond our (direct) control OS:Linux
Development

No branches or pull requests

3 participants