我正在努力让 Qt6 在嵌入式系统上工作。但我收到以下错误:
Qt6Quick could not be found because dependency Qt6QuickTools could not be found.
Could NOT find Qt6QuickTools (missing: Qt6QuickTools_DIR)
这是 Yocto 食谱:
SUMMARY = "Qt application recipe"
DESCRIPTION = "This recipe builds the Application"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
DEPENDS += "qtbase qtdeclarative qtcharts qtimageformats qtscxml qtmultimedia qtquick3d"
RDEPENDS:${PN} += "qtsvg \
qtdeclarative-qmlplugins \
ttf-dejavu-sans \
ttf-dejavu-serif \
"
SRC_URI = "github url"
SRCREV = "github commit hash"
S = "${WORKDIR}/git"
inherit qt6-cmake
do_install() {
install -d ${D}/opt/app/
install -m 0755 app ${D}/opt/app/
install -m 0755 ${S}/mod/setup.sh ${D}/opt/app/
cp -r ${S}/* ${D}/opt/app/
}
FILES:${PN} += "/opt/app/* "
这是 Qt 项目的 CMake:
cmake_minimum_required(VERSION 3.16)
project(project VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS Quick)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS QuickControls2)
find_package(Qt6 REQUIRED COMPONENTS Qml)
find_package(Qt6 REQUIRED COMPONENTS Charts)
set(PROJECT_SOURCES
main.cpp
...
qml.qrc
)
qt_add_executable(project
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
target_link_libraries(project PRIVATE Qt6::Core)
target_link_libraries(project PRIVATE Qt6::Quick)
target_link_libraries(project PRIVATE Qt6::QuickControls2)
target_link_libraries(project PRIVATE Qt6::Charts)
target_link_libraries(project PRIVATE Qt6::Qml)
if(QT_VERSION_MAJOR EQUAL 6)
qt_import_qml_plugins(project)
qt_finalize_executable(project)
endif()
我尝试过几个不同版本的 Qt。它在 Qt5 上工作正常,但在 Qt6 上失败。此外,Qt6 版本在 Windows 上的开发过程中运行良好。我很难在网上找到有关 Qt6QuickTools 的任何信息。
我猜你可能在依赖项中缺少这个“qtquick3d-native”。