failed to build simple project using cross compiled qt for aarch64
-
Hi ,
i have decent level understanding and experience with qt but this is my first time trying my hands on cross compilation in qt
i have installed Qt 5.12.12 in the location/home/traana-dww37v3/Qt5.12.12 after that i have cross compiled it for aarch64 by running this command/home/traana-dww37v3/Qt5.12.12/5.12.12/Src/configure -release -static -opensource -confirm-license -platform linux-g++ -xplatform linux-aarch64-gnu-g++ -device-option CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- -sysroot /home/traana-dww37v3/brd_rootfs -extprefix /home/traana-dww37v3/Qt5.12.12_static/static_aarch_64 -nomake examples -nomake tests -skip qtwebengine
here brd_rootfs is the target board's rootfs (its a aarch64 architecture) which i have extracted in /home/traana-dww37v3/brd_rootfs
i was able to configure and install
now i have added this version of qt in qtcreator and trying to build a simple applicationand my .pro file looks like this
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib QMAKE_LFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs QMAKE_CXXFLAGS += --sysroot=/home/traana-dww37v3/brd_rootfs SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
and when i build i get the fallowing errors
:-1: error: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/lib/../lib/Scrt1.o: in function `_start': :-1: error: (.text+0x24): undefined reference to `__libc_csu_init' :-1: error: (.text+0x28): undefined reference to `__libc_csu_fini' :-1: error: (.text+0x2c): undefined reference to `__libc_csu_fini' :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_addr@GLIBC_PRIVATE' :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_sym@GLIBC_PRIVATE' :-1: error: /usr/aarch64-linux-gnu/lib/libdl.so: undefined reference to `_dl_vsym@GLIBC_PRIVATE'
i understand these errors are related to linker
i have required Scrt1.o and crt1.o in my /home/traana-dww37v3/brd_rootfs/usr/lib location which i am pointing to so i am not understanding why i am still getting the error
should i point the compiler to use the libraries from cross compiler toolchain which is there in my host machine at /usr/aarch64-linux-gnu/lib location or it should use the target board rootfs
please help me understand what i am doing wrong and how do i resolve this issue
thanks in advance for any help -
@123newuser said in failed to build simple project using cross compiled qt for aarch64:
LIBS += -L/home/traana-dww37v3/brd_rootfs/usr/lib
don't you miss the
-l
portion? that's the path of the library(es) but shouldn't you specify the name of the library(es) also?
LikeLIBS += -lScrt1 -lcrt1
Also, are you certain they export the symbols you are referencing?
-
@VRonin said in failed to build simple project using cross compiled qt for aarch64:
Also, are you certain they export the symbols you are referencing
hi thanks for the reply what do you mean by this
and Scrt1.o and crt1.o are not libraries right so how can i add LIBS += -lScrt1 -lcrt1 -
i have checked the build environment and i have set the PATH and LD_LIBRARY_PATH variables still i am getting the errors dpnt know what else i heed to do for the linker to find the files in the correct directory
-
my host machine lists the GLIBC version 2.17 - 2.31 and the g++ -- version is 9.4.0, aarch64-linux-gnu-g++ --version is 9.4.0 and the target board GLIBC versions list from 2.17 -2.36 i was able to cross compile and run my normal c++ projects without any trouble so i don't think the GLIBC versions will be any problem for the qt cross compilation