Xavier Qt Cross-Compile

Hello, I have a problem with cross compilation.
I’ll briefly explain my situation.

Host PC: Ubuntu 18.04
Target: Jetson AGX Xavier

What I Want: Configuring the build kit in QT

What I did:

  1. Install ToolChain: gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu
  2. PATH Setting: gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin
    gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/lib
  3. Install: qt-everywhere-src-5.15.0 (for produce crosscompile qmake)
  4. Modifiy qmake.conf:
    I copied qt-everywhere-src-5.15.0/mkspecs/devices/linux-jetson-tx1-g++
    to linux-jetson-agx-xavier
    And I made some changes.
  5. Configure(at qt-everywhere-src-5.15.0/qtbase):
    sudo ./configure -top-level -device linux-jetson-agx-xavier -device-option CROSS_COMPILE=
    /opt/xavier/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -prefix
    /opt/xavier/EmbeddedQt -make libs -no-pch -no-opengl -qt-zlib -qt-libpng -qt-libjpeg -no-cups
    -gui -make examples -opensource -confirm-license -qreal float -v

Problem:

  1. ERROR: Qt requires a compliant STL library
    ERROR: C++11 is required and is missing or failed to compile.

/usr/aarch64-linux-gnu/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
Makefile:179: recipe for target ‘main.o’ failed
make: *** [main.o] Error 1

  1. When I searched about this error, I found this link.
    https://git.busybox.net/buildroot/commit/?id=3a0ed5d25e26cb2ec99a1da077c9dcfea67b0ecc

    So, I changed from ‘QMAKE_CFLAGS_ISYSTEM = -isystem’ to 'QMAKE_CFLAGS_ISYSTEM = ’ in below files. But it still doesn’t reflect and the build fails.
    qtbase/mkspecs/common/clang.conf
    qtbase/mkspecs/common/gcc-base.conf

[LOG]

  • cd /opt/xavier/qt-everywhere-src-5.15.0/config.tests/arch && /opt/xavier/qt-everywhere-src-5.15.0/qtbase/bin/qmake “CONFIG -= qt debug_and_release app_bundle lib_bundle” “CONFIG += shared warn_off console single_arch” -early “CONFIG += cross_compile” /opt/xavier/qt-everywhere-src-5.15.0/qtbase/config.tests/arch
  • cd /opt/xavier/qt-everywhere-src-5.15.0/config.tests/arch && MAKEFLAGS= /usr/bin/make

/usr/bin/aarch64-linux-gnu-g++ -c -pipe -mtune=cortex-a57.cortex-a53 -march=armv8-a -O2 -w -fPIC -I/opt/xavier/qt-everywhere-src-5.15.0/qtbase/config.tests/arch -I. -isystem /usr/include -isystem /usr/aarch64-linux-gnu/include -isystem /usr/include/aarch64-linux-gnu -I/opt/xavier/qt-everywhere-src-5.15.0/qtbase/mkspecs/devices/linux-jetson-agx-xavier -o arch.o /opt/xavier/qt-everywhere-src-5.15.0/qtbase/config.tests/arch/arch.cpp
/usr/bin/aarch64-linux-gnu-g++ -Wl,-O1 -Wl,-rpath-link,/usr/lib -Wl,-rpath-link,/usr/aarch64-linux-gnu/lib -Wl,-rpath-link,/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/lib/aarch64-linux-gnu -o arch arch.o -L/usr/lib -L/usr/aarch64-linux-gnu/lib -L/lib/aarch64-linux-gnu -L/usr/lib/aarch64-linux-gnu
Detected architecture: arm64 (neon)

Thanks in advance.

I can’t help with most of that, but for C++11, see:
https://gcc.gnu.org/projects/cxx-status.html#cxx11

You probably must explicitly pass argument “-std=c++11” (or in some cases, perhaps “-std=gnu++11”).

If you lack the standard library (once known as the STL, but STL was later absorbed into the standard library), then it probably means you didn’t install the dev version of the package. As an example on an NX with this installed:

# dpkg -S /usr/include/c++/7/vector
libstdc++-7-dev:arm64: /usr/include/c++/7/vector

One of the great difficulties about a cross build environment is getting a full sysroot for user space apps. Provided versions tend to be absolutely minimal, and you end up in a nearly infinite chain of having to custom build one thing after another. I set up my Jetsons with full dev capabilities, and clone the image. Then mount the image on the cross build host PC, and use that for the user space environment. If I need to switch to a different Jetson, then I umount the clone and mount the other clone.

If you install libstdc++-7-dev package on your Jetson you could use rsync to copy the relevant parts to some architecture specific sysroot development area of your PC (you wouldn’t have to clone everything, but it is really useful to have a full clone backup anyway).

I can’t help with the Qt parts. Qt itself is rather complicated, and I only have access to the free version on a PC, so I’ve never touched it on the Jetsons.

Hi,
This occurs throughout Qt in later versions with newer compilers.
The way to fix it is to edit $HOME/qt-everywhere-src-5.12.6/qtbase/mkspecs/common/gcc-base.conf

Change QMAKE_CFLAGS_ISYSTEM = -isystem
to QMAKE_CFLAGS_ISYSTEM = -I (capital i)
Also, insert the following lines in the qmake.conf of the device:
QMAKE_CXXFLAGS += -std=gnu++11
QMAKE_CFLAGS_ISYSTEM=-I

Jaf

4 Likes