Skip to content
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

<qt>/<6.4.2>: qt_generate_deploy_qml_app_script generates an unusable deploy script when Qt provided by Conan #17977

Closed
rhvonlehe opened this issue Jun 20, 2023 · 15 comments · Fixed by #21263
Labels
bug Something isn't working

Comments

@rhvonlehe
Copy link

Description

When Qt is brought in as a dependency via Conan the qt_generate_deploy_qml_app_script CMake function does not behave properly. This was initially raised as a bug with Qt but it became clear that the Conan recipe is the source of the issue. I can confirm that when I install Qt manually with the maintenance tool and point my project to that instance of Qt the problem goes away.

There is quite a bit of detail both here [1] and here [2].

[1] https://bugreports.qt.io/browse/QTBUG-113769
[2] https://forum.qt.io/topic/144883/qt_generate_deploy_qml_app_script-generates-script-with-empty-include

The pertinent information from the initial analysis by Qt is this quote:

It appears that the generated CMake files that create the Qt targets include Qt's macro files:

D:/Projects/QWar/build/Release/generators/Qt6Config.cmake(37):  include(C:/.conan/ac5814/1/lib/cmake/Qt6Core/Qt6CoreMacros.cmake )
but don't include Qt6CoreConfigExtras.cmake.

That's nothing Qt has influence over. Please report this to the maintainer of the conan Qt package. They either need to include the extras file or set the QT6_IS_SHARED_LIBS_BUILD variable in the Qt CMake package files that are generated.

Note that QT6_IS_SHARED_LIBS_BUILD also influences the behavior of qt_add_library and qt_add_plugin.

Package and Environment Details

qt/6.4.2
windows
MSVC (visual studio 2019)
conan 1.58.0
Python 3.9.0

Conan profile

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce

Requirement: have MSVC installed (I use 2019 but other recent versions should work, too). MSVC should be the default profile. If not specify the MSVC profile.

git clone -b qtbug-113769 https://github.com/rhvonlehe/QWar.git
cd QWar
conan install . -pr=default   
conan build .

You should get an error at the end that looks like this:

CMake Error at C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3088 (message):
  Support for installing runtime dependencies is not implemented for this
  target platform (Windows, static Qt libs).
Call Stack (most recent call first):
  C:/.conan/ac5814/1/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script)
  client/CMakeLists.txt:37 (qt_generate_deploy_qml_app_script)

because the deploy script is basically empty due to this bug.

Logs

Here's a link to the cmake trace from QTBUG-113769:

https://bugreports.qt.io/secure/attachment/141742/cmake.trace

@rhvonlehe rhvonlehe added the bug Something isn't working label Jun 20, 2023
@ericLemanissier
Copy link
Contributor

Can you please try with #17925

@ericLemanissier
Copy link
Contributor

this is a duplicate of #17743 I think

@rhvonlehe
Copy link
Author

Can you please try with #17925

I will try after work today hopefully

@rhvonlehe
Copy link
Author

rhvonlehe commented Jun 21, 2023

I'm not 100% sure how to specify a branch name for a dependency. How do I get a version of Qt from a PR branch? My current conanfile.py gets Qt like this:

from conans import ConanFile
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout

class QWar(ConanFile):
    name = "QWar"
    version = "0.1"
    settings = "os", "compiler", "build_type", "arch"
    requires = "boost/1.77.0", "qt/6.4.2"
    generators = "CMakeToolchain", "CMakeDeps"

@MartinDelille
Copy link
Contributor

You need to checkout the PR on your local clone of this repositoy and then export the recipe like this:

conan export recipes/qt/6.x.x qt/6.4.2@

@rhvonlehe
Copy link
Author

Thanks for the help getting me going with your branch. For me, the original problem is fixed. The deploy script gets generated and my install makes it pretty far. The Qt DLL dependencies are installed, but then I hit this new error:

CMake Error at C:/.conan/39921b/1/lib/cmake/Qt6Qml/Qt6QmlDeploySupport.cmake:51 (message):
  No QML imports information recorded for target QWarClient.  The target must
  be an executable and qt_add_qml_module() must have been called with it.  If
  using a CMake version lower than 3.19, ensure that the executable is
  manually finalized with qt_finalize_target().  Missing file:

      D:/Projects/QWar/build/Release/.qt/deploy_qml_imports/QWarClient.cmake
Call Stack (most recent call first):
  .qt/deploy_qml_app_QWarClient_95aee93070.cmake:5 (qt_deploy_qml_imports)
  client/cmake_install.cmake:40 (include)
  cmake_install.cmake:62 (include)

@MartinDelille
Copy link
Contributor

I have exactly the same error on MacOS as explained here: #17925 (comment)

I dig into Qt core without understanding when this file should be generated.

@jobor
Copy link

jobor commented Jun 29, 2023

Is a CMake version older than 3.19 used here?

@rhvonlehe
Copy link
Author

rhvonlehe commented Jun 29, 2023 via email

@jobor
Copy link

jobor commented Jul 11, 2023

The underlying issue seems to have been found: #17925 (comment)

@MartinDelille
Copy link
Contributor

Unfortunately not yet. I stopped working on this and wrote a simple recipe that use Qt official binaries.

@rhvonlehe
Copy link
Author

rhvonlehe commented Jul 11, 2023 via email

@takacsd
Copy link

takacsd commented Aug 17, 2023

Unfortunately not yet. I stopped working on this and wrote a simple recipe that use Qt official binaries.

Can you make that recipe available? Asking for a friend... ;)

@MartinDelille
Copy link
Contributor

Yes here it is: https://github.com/MartinDelille/qt-conan

Feel free to contribute if you have an idea how to improve it!

@takacsd
Copy link

takacsd commented Aug 17, 2023

Yes here it is: https://github.com/MartinDelille/qt-conan

Feel free to contribute if you have an idea how to improve it!

Thanks, looks simple indeed. :) Will look into it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants