Unsolved Cross-compile QT 5.15 for Jetson Xavier link errors
-
I'm trying to cross-compile QT 5.15 for a Jetson Xavier. The latest JetPack only provides Qt 5.9. I was able to compile it natively on the device, but when I tried to cross-compile it from Ubuntu Linux I receive the following error:
.obj/qlibrary_unix.o: In function `QLibraryPrivate::load_sys()': qlibrary_unix.cpp:(.text+0xcec): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/andreac/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs//usr/lib/aarch64-linux-gnu/libm.a(e_atan2.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/andreac/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs//usr/lib/aarch64-linux-gnu/libm.a(e_atan2.o)(.text+0x18): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17' /usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Makefile:1238: recipe for target '../../lib/libQt5Core.so.5.15.0' failed make[3]: *** [../../lib/libQt5Core.so.5.15.0] Error 1 make[3]: Leaving directory '/home/andreac/src/qt5-build/qtbase/src/corelib' Makefile:226: recipe for target 'sub-corelib-make_first' failed make[2]: *** [sub-corelib-make_first] Error 2 make[2]: Leaving directory '/home/andreac/src/qt5-build/qtbase/src' Makefile:50: recipe for target 'sub-src-make_first' failed make[1]: *** [sub-src-make_first] Error 2 make[1]: Leaving directory '/home/andreac/src/qt5-build/qtbase' Makefile:88: recipe for target 'module-qtbase-make_first' failed make: *** [module-qtbase-make_first] Error 2
I configured the build with these parameters:
../qt5/configure -opensource \ -xplatform linux-aarch64-gnu-g++ \ -device-option CROSS_COMPILE=/usr/aarch64-linux-gnu/ \ -sysroot ~/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs/ -prefix /opt/local/qt5 \ -nomake examples -nomake tests
The error message is a bit confusing, as I see
-fPIC
in the compilation command, e.g.:aarch64-linux-gnu-g++ -c -include .pch/Qt5Core -pipe --sysroot=/home/andreac/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs/ -O3 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -I/home/andreac/src/qt5/qtbase/src/corelib -I. -Iglobal -I/home/andreac/src/qt5/qtbase/src/3rdparty/md5 -I/home/andreac/src/qt5/qtbase/src/3rdparty/md4 -I/home/andreac/src/qt5/qtbase/src/3rdparty/sha3 -I/home/andreac/src/qt5/qtbase/src/3rdparty -I/home/andreac/src/qt5/qtbase/src/3rdparty/double-conversion/include -I/home/andreac/src/qt5/qtbase/src/3rdparty/harfbuzz/src -I/home/andreac/src/qt5/qtbase/src/3rdparty/forkfd -I/home/andreac/src/qt5/qtbase/src/3rdparty/tinycbor/src -I.rcc -I../../include -I../../include/QtCore -I../../include/QtCore/5.15.0 -I../../include/QtCore/5.15.0/QtCore -I.moc -I.tracegen -I/home/andreac/src/qt5/qtbase/src/3rdparty/pcre2/src -I/home/andreac/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs/usr/include/glib-2.0 -I/home/andreac/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/rootfs/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/home/andreac/src/qt5/qtbase/mkspecs/linux-aarch64-gnu-g++ -o .obj/moc_qmimetype.o .moc/moc_qmimetype.cpp
What am I missing?
-
I encountered this issue. I use rsync to copy the update /usr/lib, /usr/include, /lib folder from the machine with jetson-tx2 to the machine with ubuntu. The actual paths of the symlink files point to were broken. You need to corrrect the linked path of symlink file and re-compile