基于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

上一篇:Qt5的插件


下一篇:Ubuntu16.04安装qt5的命令