Linux教程

基于Yocto的qmake编译环境默认QMAKE_SPEC不是linux-oe-g++的问题

本文主要是介绍基于Yocto的qmake编译环境默认QMAKE_SPEC不是linux-oe-g++的问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

项目场景:

https://github.com/meta-qt5/meta-qt5 krogoth
Qt版本为:Qt 5.6.3


问题描述:

配置本地编译环境 Qt Creator 后发现需要在 IDE 的中指定 Qt mkspec 为 linux-oe-g++ 才能编译通过


原因分析:

通过分析 meta-qt5/classes/qmake5_base.bbclass 文件得知该版本存在一个书写BUG(TargetSpec 写成了 TartgetSpec)

do_generate_qt_config_file() {
    cat > ${QT_CONF_PATH} <<EOF
[Paths]
Prefix = ${OE_QMAKE_PATH_PREFIX}
Headers = ${OE_QMAKE_PATH_HEADERS}
Libraries = ${OE_QMAKE_PATH_LIBS}
ArchData = ${OE_QMAKE_PATH_ARCHDATA}
Data = ${OE_QMAKE_PATH_DATA}
Binaries = ${OE_QMAKE_PATH_BINS}
LibraryExecutables = ${OE_QMAKE_PATH_LIBEXECS}
Plugins = ${OE_QMAKE_PATH_PLUGINS}
Imports = ${OE_QMAKE_PATH_IMPORTS}
Qml2Imports = ${OE_QMAKE_PATH_QML}
Translations = ${OE_QMAKE_PATH_TRANSLATIONS}
Documentation = ${OE_QMAKE_PATH_DOCS}
Settings = ${OE_QMAKE_PATH_SETTINGS}
Examples = ${OE_QMAKE_PATH_EXAMPLES}
Tests = ${OE_QMAKE_PATH_TESTS}
HostBinaries = ${OE_QMAKE_PATH_HOST_BINS}
HostData = ${OE_QMAKE_PATH_HOST_DATA}
HostLibraries = ${OE_QMAKE_PATH_HOST_LIBS}
HostSpec = ${OE_QMAKESPEC}
TartgetSpec = ${OE_XQMAKESPEC} 
ExternalHostBinaries = ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}
Sysroot = ${STAGING_DIR_TARGET}
EOF
}

解决方案:

订正 meta-qt5/classes/qmake5_base.bbclass 书写错误:TartgetSpec 改为 TargetSpec

这篇关于基于Yocto的qmake编译环境默认QMAKE_SPEC不是linux-oe-g++的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!