error "relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `__stack_chk_guard@@GLIBC_2.17'" in QT5.8.0 source building with Cross compiler aarch64
-
hi,
I compile QT5.8.0 source with Cross compiler aarch64:
Linux: Ubuntu 14.04
Cross compiler: gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu
QT: 5.8.0
configure:
./configure
-v
-opensource
-confirm-license
-device-option CROSS_COMPILE=/home/suma/GUI/gcc/gcc-linaro/bin/aarch64-linux-gnu-
-device linux-jetson-tx1-g++
-prefix /usr/local/qt5
-extprefix /home/suma/GUI/qt/qt5
-hostprefix /home/suma/GUI/qt/qt5-host
-nomake examples
-nomake tests
-opengl es2
-sysroot /home/suma/tx1/Linux_for_Tegra/rootfs
make :
when create libQt5Core.so.5.8.0 (qt-everywhere-opensource-src-5.8.0/qtbase/src/corelib),
I encounter a error like below:
../lib/gcc/aarch64-linux-gnu/6.2.1/../../../../aarch64-linux-gnu/bin/ld: /home/suma/tx1/Linux_for_Tegra/rootfs/lib/aarch64-linux-gnu/libz.a(compress.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol__stack_chk_guard@@GLIBC_2.17' can not be used when making a shared object; **recompile with -fPIC** ../lib/gcc/aarch64-linux-gnu/6.2.1/../../../../aarch64-linux-gnu/bin/ld: /home/suma/tx1/Linux_for_Tegra/rootfs/lib/aarch64-linux-gnu/libz.a(compress.o)(.text+0x10): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol
__stack_chk_guard@@GLIBC_2.17'
../lib/gcc/aarch64-linux-gnu/6.2.1/../../../../aarch64-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [../../lib/libQt5Core.so.5.8.0] Error 1QT5.8.0 makefile like this :
CFLAGS = -pipe -mtune=cortex-a57.cortex-a53 -march=armv8-a --sysroot=/home/suma/tx1/Linux_for_Tegra/rootfs -O2 -fvisibility=hidden -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -mtune=cortex-a57.cortex-a53 -march=armv8-a --sysroot=/home/suma/tx1/Linux_for_Tegra/rootfs -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC $(DEFINES)
LFLAGS = -Wl,-rpath-link,/home/suma/tx1/Linux_for_Tegra/rootfs/usr/lib -Wl,-rpath-link,/home/suma/tx1/Linux_for_Tegra/rootfs/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/home/suma/tx1/Linux_for_Tegra/rootfs/usr/lib/aarch64-linux-gnu/tegra -Wl,-rpath-link,/home/suma/tx1/Linux_for_Tegra/rootfs/lib/aarch64-linux-gnu --sysroot=/home/suma/tx1/Linux_for_Tegra/rootfs -Wl,--no-undefined -Wl,--version-script,QtCore.version -Wl,-O1 -Wl,--enable-new-dtags -shared -Wl,-soname,libQt5Core.so.5so I have builded with -fPIC,but this error haved not solved.
Any Ideas?
-
changing the path order of the linked libraries can fix my issue!
error path:
QMAKE_LIBDIR +=
$$[QT_SYSROOT]/usr/lib
$$[QT_SYSROOT]/lib/aarch64-linux-gnu
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu
rigth path :
QMAKE_LIBDIR +=
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu
$$[QT_SYSROOT]/usr/lib
$$[QT_SYSROOT]/lib/aarch64-linux-gnu
Note :
/usr/lib/_ (1)
/usr/lib (2)
/lib (end)