conan-io / conan-center-index

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

[package] qt/6.4.2: qt_import_qml_plugins doesnt scan for qt folders #17005

Open bsespede opened 1 year ago

bsespede commented 1 year ago

Description

I'm trying to build an static qt app with qml, but the qt_import_qml_plugins macro doesnt import libs from qt qml folder - thus leading to plugin not found errors.

Package and Environment Details

Conan profile

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

Steps to reproduce

Using the follow conan recipe:

[requires]
qt/6.4.2
[options]
qt/*:qtdeclarative=True
qt/*:qtshadertools=True
qt/*:shared=False
[generators]
CMakeDeps
CMakeToolchain

and the following CMakeLists:

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Gui Quick QmlImportScanner)

qt_add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_ICON})

qt_add_qml_module(${PROJECT_NAME}
URI
${PROJECT_NAME}
VERSION
1.0
QML_FILES
${PROJECT_QMLS}
RESOURCES
${PROJECT_RESOURCES}
)

target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Gui Qt6::Quick Qt6::QWindowsIntegrationPlugin)

qt_import_qml_plugins(${PROJECT_NAME})

Compiles fine but when running binary leads to:

QQmlApplicationEngine failed to load component                                                                          qrc:/Launcher/src/view/Launcher.qml:1:1: module "QtQuick" plugin "qtquick2plugin" not found

Logs

Click to expand log ``` [Put your log output here](qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QIconEngineFactoryInterface" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QImageIOHandlerFactoryInterface" since plugins are disabled in static builds qt.qml.import: addImportPath: "C:/.conan/6f0042/1/res/archdatadir/qml" qt.qml.import: addImportPath: "qrc:/qt-project.org/imports" qt.qml.import: addImportPath: "C:/Development/GDOAgain!/launcher_priv/build/Release" qt.qml.import: addLibraryImport: qrc:/Launcher/src/view/Launcher.qml "QtQuick" version ' invalid ' as "" qt.qml.import: importExtension: qrc:/Launcher/src/view/Launcher.qml loaded "C:/.conan/6f0042/1/res/archdatadir/qml/QtQuick/qmldir" qt.qml.import: resolvePlugin Could not resolve dynamic plugin with base name "qtquick2plugin" in "C:/.conan/6f0042/1/res/archdatadir/qml/QtQuick" file does not exist qt.qml.import: locateLocalQmldir: QtQuick module's qmldir found at "C:/.conan/6f0042/1/res/archdatadir/qml/QtQuick/qmldir" QQmlApplicationEngine failed to load component qrc:/Launcher/src/view/Launcher.qml:1:1: module "QtQuick" plugin "qtquick2plugin" not found qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QAccessibleBridgeFactoryInterface" since plugins are disabled in static builds) ```
bsespede commented 1 year ago

Tried building Qt 6.4.2 without Conan and it worked, so I'm guessing there is something wrong with the QML libs importing

arunpkio commented 11 months ago

@bsespede I also ran into similar issue with conan Qt 6.5. Did you find any way to fix it?