简体   繁体   中英

Yocto: CMake tries linking libraries from sysroot native

I am trying to create a Bitbake recipe for QJson ( https://github.com/flavio/qjson ) that should run with the embedded version of Qt4. My Bitbake recipe contains the following lines

SECTION = "libs"
DEPENDS = "qt4-embedded"

... license stuff etc.

SRC_URI = "git://github.com/flavio/qjson.git;protocol=https"
S = "${WORKDIR}/git"

inherit qt4e cmake pkgconfig

When I know run bitbake qjson I'm getting the following error during linking:


| /<DIR>/cortexa53-crypto-poky-linux/qjson/0.9.0+gitAUTOINC+4920592171-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/10.2.0/ld: 
  /<DIR>/cortexa53-crypto-poky-linux/qjson/0.9.0+gitAUTOINC+4920592171-r0/recipe-sysroot-native/usr/lib/libQtCore.so: 
  error adding symbols: file in wrong format

CMake seems to link the build against the native libraries (x86_64) in recipe-sysroot-native/usr/lib instead of the ones build for the target device (aarch64) located in recipe-sysroot/usr/lib .

I don't really know how I can modify my recipe so that CMake passes

-Wl,-rpath,/<DIR>/cortexa53-crypto-poky-linux/qjson/0.9.0+gitAUTOINC+4920592171-r0/recipe-sysroot/usr/lib

to the compiler instead of

-Wl,-rpath,/<DIR>/cortexa53-crypto-poky-linux/qjson/0.9.0+gitAUTOINC+4920592171-r0/recipe-sysroot-native/usr/lib

Try adding this to your recipe:

EXTRA_OECMAKE += " \
-DQT_QMAKE_EXECUTABLE=${OE_QMAKE_QMAKE} \
-DQT_LRELEASE_EXECUTABLE=${OE_QMAKE_LRELEASE} \
-DQT_MOC_EXECUTABLE=${OE_QMAKE_MOC} \
-DQT_UIC_EXECUTABLE=${OE_QMAKE_UIC} \
-DQT_RCC_EXECUTABLE=${OE_QMAKE_RCC} \
-DQT_LIBRARY_DIR=${OE_QMAKE_LIBDIR_QT} \
-DQT_HEADERS_DIR=${OE_QMAKE_INCDIR_QT} \
-DQT_QTCORE_INCLUDE_DIR=${OE_QMAKE_INCDIR_QT}/QtCore \
-DQT_LIBINFIX=${QT_LIBINFIX} \
-DQT_MKSPECS_DIR=${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs \
"

I got this from looking at qmmp bitbake recipe and cmake_qt5.bbclass. The QT_MKSPECS_DIR come to me when debugging FindQt4.cmake

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM