交叉编译Beaglebone的Qt5时出现链接错误

时间:2019-02-07 11:28:40

标签: linker qt5 cross-compiling beagleboneblack

尊敬的stackoverflow社区。

我正在为带有EGL支持的Beaglebone Black交叉编译Qt 5.12。主机操作系统是在VM中运行的Ubuntu 18.04.1 LTS(x64)。我已经在目标(以及主机上的某些主机)上安装了任何可能的依赖项(我可以在不同的文章中找到),并将sysroot复制到主机上。基本上,我遵循了最初是RPi2的指南:https://wiki.qt.io/RaspberryPi2EGLFS Qt5base软件包可以很好地编译,至少我认为是这样。它可以安装,但是配置测试中会出现一些错误。我待会儿再回来。

现在,我也尝试构建qtdeclarative。 Qmake运行时没有任何错误,但make失败,并出现链接错误。 libQt5Core.so找不到某些引用,因为未找到某些依赖项。例如libicudata.so.57。当然,我检查了它们在sysroot下的正确位置,并且它们位于正确的位置。 我想原来的qtbase构建有问题,因为我在某些配置测试中有类似的错误(但是使用不同的库),并且如果我尝试构建示例应用程序,则是相同的。

以下是一些信息...

qtbase构建中的配置命令行:

Command line: -release -opengl es2 -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/home/martin/beaglebone/tools/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/martin/beaglebone/sysroot -opensource -confirm-license -make libs -make tools -prefix /usr/local/qt5bbb -extprefix /home/martin/beaglebone/qt5build/qt5bbb -hostprefix /home/martin/beaglebone/qt5build/qt5 -qt-zlib -qt-libpng -no-use-gold-linker -v

所有qmake持久变量的转储:

~/beaglebone/qt5build/qt5/bin/qmake -query
QT_SYSROOT:/home/martin/beaglebone/sysroot
QT_INSTALL_PREFIX:/home/martin/beaglebone/qt5build/qt5bbb
QT_INSTALL_PREFIX/dev:/usr/local/qt5bbb
QT_INSTALL_ARCHDATA:/home/martin/beaglebone/qt5build/qt5bbb
QT_INSTALL_ARCHDATA/dev:/usr/local/qt5bbb
QT_INSTALL_DATA:/home/martin/beaglebone/qt5build/qt5bbb
QT_INSTALL_DATA/dev:/usr/local/qt5bbb
QT_INSTALL_DOCS:/home/martin/beaglebone/qt5build/qt5bbb/doc
QT_INSTALL_DOCS/dev:/usr/local/qt5bbb/doc
QT_INSTALL_HEADERS:/home/martin/beaglebone/qt5build/qt5bbb/include
QT_INSTALL_HEADERS/dev:/usr/local/qt5bbb/include
QT_INSTALL_LIBS:/home/martin/beaglebone/qt5build/qt5bbb/lib
QT_INSTALL_LIBS/dev:/usr/local/qt5bbb/lib
QT_INSTALL_LIBEXECS:/home/martin/beaglebone/qt5build/qt5bbb/libexec
QT_INSTALL_LIBEXECS/dev:/usr/local/qt5bbb/libexec
QT_INSTALL_BINS:/home/martin/beaglebone/qt5build/qt5bbb/bin
QT_INSTALL_BINS/dev:/usr/local/qt5bbb/bin
QT_INSTALL_TESTS:/home/martin/beaglebone/qt5build/qt5bbb/tests
QT_INSTALL_TESTS/dev:/usr/local/qt5bbb/tests
QT_INSTALL_PLUGINS:/home/martin/beaglebone/qt5build/qt5bbb/plugins
QT_INSTALL_PLUGINS/dev:/usr/local/qt5bbb/plugins
QT_INSTALL_IMPORTS:/home/martin/beaglebone/qt5build/qt5bbb/imports
QT_INSTALL_IMPORTS/dev:/usr/local/qt5bbb/imports
QT_INSTALL_QML:/home/martin/beaglebone/qt5build/qt5bbb/qml
QT_INSTALL_QML/dev:/usr/local/qt5bbb/qml
QT_INSTALL_TRANSLATIONS:/home/martin/beaglebone/qt5build/qt5bbb/translations
QT_INSTALL_TRANSLATIONS/dev:/usr/local/qt5bbb/translations
QT_INSTALL_CONFIGURATION:/home/martin/beaglebone/qt5build/qt5bbb/etc/xdg
QT_INSTALL_CONFIGURATION/dev:/usr/local/qt5bbb/etc/xdg
QT_INSTALL_EXAMPLES:/home/martin/beaglebone/qt5build/qt5bbb/examples
QT_INSTALL_EXAMPLES/dev:/usr/local/qt5bbb/examples
QT_INSTALL_DEMOS:/home/martin/beaglebone/qt5build/qt5bbb/examples
QT_INSTALL_DEMOS/dev:/usr/local/qt5bbb/examples
QT_HOST_PREFIX:/home/martin/beaglebone/qt5build/qt5
QT_HOST_DATA:/home/martin/beaglebone/qt5build/qt5
QT_HOST_BINS:/home/martin/beaglebone/qt5build/qt5/bin
QT_HOST_LIBS:/home/martin/beaglebone/qt5build/qt5/lib
QMAKE_SPEC:linux-g++
QMAKE_XSPEC:devices/linux-beagleboard-g++
QMAKE_VERSION:3.1
QT_VERSION:5.12.2

失败的qtdeclarative版本的代码段:

/home/martin/beaglebone/tools/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/6.4.1/../../../../arm-linux-gnueabihf/bin/ld: warning: libicudata.so.57, needed by /home/martin/beaglebone/qt5build/qt5bbb/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/home/martin/beaglebone/qt5build/qt5bbb/lib/libQt5Core.so: Warnung: undefinierter Verweis auf »ucol_getSortKey_57«

提到的标题如此:

readelf -d /home/martin/beaglebone/qt5build/qt5bbb/lib/libQt5Core.so

Dynamic section at offset 0x4125b0 contains 37 entries:
  Tag       Typ                          Name/Wert
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libpthread.so.0]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libicui18n.so.57]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libicuuc.so.57]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libicudata.so.57]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [librt.so.1]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libdl.so.2]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libstdc++.so.6]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libm.so.6]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [libc.so.6]
 0x00000001 (NEEDED)                     Gemeinsame Bibliothek [ld-linux-armhf.so.3]
 0x0000000e (SONAME)                     soname der Bibliothek: [libQt5Core.so.5]
 0x0000000c (INIT)                       0x6ab1c
 0x0000000d (FINI)                       0x298ed0
 0x00000019 (INIT_ARRAY)                 0x41c000
 0x0000001b (INIT_ARRAYSZ)               16 (Bytes)
 0x0000001a (FINI_ARRAY)                 0x41c010
 0x0000001c (FINI_ARRAYSZ)               12 (Bytes)
 0x00000004 (HASH)                       0x158
 0x00000005 (STRTAB)                     0x20c6c
 0x00000006 (SYMTAB)                     0x838c
 0x0000000a (STRSZ)                      228634 (Bytes)
 0x0000000b (SYMENT)                     16 (Bytes)
 0x00000003 (PLTGOT)                     0x4226f8
 0x00000002 (PLTRELSZ)                   24664 (Bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x64ac4
 0x00000011 (REL)                        0x5beac
 0x00000012 (RELSZ)                      35864 (Bytes)
 0x00000013 (RELENT)                     8 (Bytes)
 0x6ffffffc (VERDEF)                     0x5baa4
 0x6ffffffd (VERDEFNUM)                  16
 0x6ffffffe (VERNEED)                    0x5bccc
 0x6fffffff (VERNEEDNUM)                 8
 0x6ffffff0 (VERSYM)                     0x58986
 0x6ffffffa (RELCOUNT)                   1928
 0x00000000 (NULL)                       0x0

查找libicudata:

locate libicudata.so.57
/home/martin/beaglebone/sysroot/lib/arm-linux-gnueabihf/libicudata.so.57
/home/martin/beaglebone/sysroot/usr/lib/arm-linux-gnueabihf/libicudata.so.57
/home/martin/beaglebone/sysroot/usr/lib/arm-linux-gnueabihf/libicudata.so.57.1
/home/martin/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libicudata.so.57
/home/martin/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libicudata.so.57.1

链接器如何搜索动态库的依赖项?因为我在同一主机上也有一个RPi3 sysroot,这可能是“双重匹配”吗? 如果有帮助,我可以从qtbase构建中提供配置日志。

感谢和问候, 马丁。

1 个答案:

答案 0 :(得分:0)

我一遍又一遍地承受着同样的痛苦。使用chroot并在那里编译。这是我的whole post