Hi, I’ve downloaded JetPack Cross Compilation container from here.
And I found in /usr/bin
there has been a cross-compiler aarch64-linux-gnu-
with version 11.4.0.
root@ubuntu:/usr/bin# aarch64-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/11/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
And I can also download another cross compiler from Jetpack Linux with version 11.3.0.
I tried to find the version of this compiler, it printed some error:
root@ubuntu:/workspaces/Code# /l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-g
nu-g++ -v
Using built-in specs.
COLLECT_GCC=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-g++.br_real
COLLECT_LTO_WRAPPER=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/aarch64-buildroot-linux-gnu/11.3.0/lto-wrapper
Target: aarch64-buildroot-linux-gnu
Configured with: ./configure --prefix=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1 --sysconfdir=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1/etc --enable-static --target=aarch64-buildroot-linux-gnu --with-sysroot=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --enable-plugins --enable-lto --with-gmp=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1 --with-mpc=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1 --with-mpfr=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1 --with-pkgversion='Buildroot 2022.08' --with-bugurl=http://bugs.buildroot.net/ --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-abi=lp64 --with-cpu=cortex-a53 --enable-languages=c,c++,fortran --with-build-time-tools=/sources/buildroot-source_toolchains.bootlin.com-2022.08.1/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/bin --enable-shared --enable-libgomp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (Buildroot 2022.08)
COMPILER_PATH=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/aarch64-buildroot-linux-gnu/11.3.0/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/bin/
LIBRARY_PATH=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/lib/../lib64/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/lib/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/lib/:/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-fstack-protector-strong' '-fPIE' '-pie' '-v' '-shared-libgcc' '-mcpu=cortex-a53' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'a.'
/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/aarch64-buildroot-linux-gnu/11.3.0/collect2 -plugin /l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/aarch64-buildroot-linux-gnu/11.3.0/liblto_plugin.so -plugin-opt=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../libexec/gcc/aarch64-buildroot-linux-gnu/11.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccRwpmLA.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot --eh-frame-hdr -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux -pie /l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/Scrt1.o /l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/crti.o /l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/crtbeginS.o -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0 -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/lib/../lib64 -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64 -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64 -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/lib -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/lib -L/l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib -z max-page-size=65536 -z common-page-size=65536 -z now -z relro -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/crtendS.o /l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/crtn.o
/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: /l4t/toolchain/aarch64--glibc--stable-2022.08-1/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/Scrt1.o: in function `_start':
(.text+0x1c): undefined reference to `main'
/l4t/toolchain/aarch64--glibc--stable-2022.08-1/bin/../lib/gcc/aarch64-buildroot-linux-gnu/11.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: (.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
And I also found that the compiler version on Jetson Orin AGX device (flashed by sdkmanager) is 11.4.0.
lumina@ubuntu:~$ aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/11/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
My questions are:
Q1. Why does aarch64-buildroot-linux-gnu-g++ -v
give error?
Q2. What’s the difference between these two cross compilers?
Q3. And which one should I use?
Thanks!