conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
957 stars 1.75k forks source link

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

Closed rhvonlehe closed 11 months ago

rhvonlehe commented 1 year ago

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

ericLemanissier commented 1 year ago

Can you please try with https://github.com/conan-io/conan-center-index/pull/17925

ericLemanissier commented 1 year ago

this is a duplicate of https://github.com/conan-io/conan-center-index/issues/17743 I think

rhvonlehe commented 1 year ago

Can you please try with #17925

I will try after work today hopefully

rhvonlehe commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

I have exactly the same error on MacOS as explained here: https://github.com/conan-io/conan-center-index/pull/17925#issuecomment-1600540738

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

jobor commented 1 year ago

Is a CMake version older than 3.19 used here?

rhvonlehe commented 1 year ago

I am using 3.23+ in all my testing

On Thu, Jun 29, 2023, 6:40 AM Jörg Bornemann @.***> wrote:

Is a CMake version older than 3.19 used here?

— Reply to this email directly, view it on GitHub https://github.com/conan-io/conan-center-index/issues/17977#issuecomment-1612977381, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPA2523OC7K7LGSOKISHWLXNVST7ANCNFSM6AAAAAAZMULREM . You are receiving this because you authored the thread.Message ID: @.***>

jobor commented 1 year ago

The underlying issue seems to have been found: https://github.com/conan-io/conan-center-index/pull/17925#issuecomment-1602805082

MartinDelille commented 1 year ago

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

rhvonlehe commented 1 year ago

I haven't even looked at it lately, either. My day job has me quite busy right now and using Conan with my Qt hobby project has taken a back seat. It is still an open issue I believe.

On Tue, Jul 11, 2023 at 9:12 AM Martin Delille @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/conan-io/conan-center-index/issues/17977#issuecomment-1630909319, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPA257SQWRGAIS5JMSQQ33XPVNLDANCNFSM6AAAAAAZMULREM . You are receiving this because you authored the thread.Message ID: @.***>

takacsd commented 1 year ago

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 commented 1 year ago

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

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

takacsd commented 1 year ago

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