Linking error while cross compiling Qt5 for Beaglebone

1

Dear stackoverflow community.

I'm cross-compiling Qt 5.12 for my Beaglebone Black with EGL support. The host OS is Ubuntu 18.04.1 LTS (x64) running in a VM. I have installed any possible dependcies (I could find in different posts) on the target (and some on the host as well) and copied a sysroot over to the host. Basically I followed this guide which is originally for RPi2: https://wiki.qt.io/RaspberryPi2EGLFS The Qt5base package compiles fine, at least I do think so. It makes and installs, but there are some errors from configuration tests. I will come back to them later.

Now I try to build qtdeclarative as well. Qmake runs without any error, but the make fails with a linkage error. libQt5Core.so cannot find some references because some dependencies are not found. For example libicudata.so.57. Of course I checked they are in the right place under sysroot and they are. I suppose there is something wrong with the original qtbase build, because I had similar errors from some configuration tests (but with different libraries) and if I try to build an example application it is the same.

Here are some information...

The configuration command line from the qtbase build:

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

The dump of all qmake persistent variables:

~/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

A snippet from the failing qtdeclarative build:

/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«

The header of the mentioned so:

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

A locate search for 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

How does the linker search for dependencies of dynamic libraries? Could it be the "double match" because I have a RPi3 sysroot on the same host as well? I can provide configuration log from the qtbase build, if that is helpful.

Thanks and best regards, Martin.

linker
qt5
cross-compiling
beagleboneblack
asked on Stack Overflow Feb 7, 2019 by martink

1 Answer

0

I went to the same pain over and over. Use the chroot and compile there. Here is my whole post

answered on Stack Overflow Aug 9, 2019 by user2195463

User contributions licensed under CC BY-SA 3.0