Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt creator and cross compile for nvidia jetson nano



  • Hi,
    I try to setup Qt creator for cross compile to nvidia jetson nano.
    So I download gcc toolchain from nvidia which contains aarch64-unknown-linux-gnu-g++.

    Then I build and install qt from source with this parametrs:

    ../configure 
    -xplatform linux-aarch64-gnu-g++ 
    -device-option CROSS_COMPILE=/opt/nvidia/toolchain_28.3.2/bin/aarch64-unknown-linux-gnu- 
    -sysroot /opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot 
    -nomake examples 
    -nomake tests 
    -prefix /usr/local/qt5 
    -extprefix /opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot/usr/local/qt5 
    -hostprefix /opt/nvidia/toolchain_28.3.2/qt5-host 
    -opengl es2
    

    Next I rsync my /usr/include and /usr/lib from jetson nano to /opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot/usr

    In Qt creator I create kit where set qt path to:

    /opt/nvidia/toolchain_28.3.2/qt5-host/bin/qmake
    

    Sysroot path to:

    /opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot
    

    and set C and C++ compiler to:

    /opt/nvidia/toolchain_28.3.2/bin/aarch64-unknown-linux-gnu-g++
    /opt/nvidia/toolchain_28.3.2/bin/aarch64-unknown-linux-gnu-gcc
    

    I the system I have also Instaled aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ which cames with nvidia SDK.
    And now my problem. When I try to compile the basic qt helloWorld with the kit then I see

    aarch64-linux-gnu-g++ -c -pipe --sysroot=/opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot -std=c++11 -g -std=gnu++11 -Wall -W -fPIC -DQT_QML_DEBUG -I../untitled -I. -I/opt/nvidia/toolchain_28.3.2/qt5-host/mkspecs/linux-aarch64-gnu-g++ -o main.o ../untitled/main.cpp
    aarch64-linux-gnu-g++ --sysroot=/opt/nvidia/toolchain_28.3.2/aarch64-unknown-linux-gnu/sysroot -o unitled main.o      
    13:55:12: The process "/usr/bin/make" exited normally.
    13:55:12: Elapsed time: 00:00.
    

    Problem is that is used aarch64-linux-gnu-g++ instead of aarch64-unknown-linux-gnu-g++ and are not used libs and header files from sysroot but from /usr/aarch64-linux-gnu path. Plus in qt creator I see the red underline:

    iostream file not found
    

    even the compile works fine. See in the screen shot (https://ibb.co/McLXXdx).

    When I run qmake I see this?

    14:19:16: Starting: "/opt/nvidia/toolchain_28.3.2/qt5-host/bin/qmake" /home/pac_jakub/untitled/untitled.pro -spec linux-aarch64-gnu-g++ CONFIG+=debug CONFIG+=qml_debug
    14:19:16: The process "/opt/nvidia/toolchain_28.3.2/qt5-host/bin/qmake" exited normally.
    

    If I configure kit to aarch64-linux-gnu-g++ everything works fine, red underline disappears but also are not used libs from sysroot.

    My question is how to configure cross compile to use libs and header files from sysroot with indexer working fine. I don't really care if I use aarch64-linux-gnu-g++ or aarch64-unknown-linux-gnu-g++ beacause they are both recommended by nvidia.
    Is something wrong with configuration of crooscompile qt? Or I need setup some enviroment ? Or somethink else?

    Thank you for your help


Log in to reply