If you are developing c++ code for use on any of the Nvidia Jetson product line, and you can use bazel to build your code, feel free to try out my bazel cross compile toolchain definition. I’m not a compiler expert, so use with caution and send PRs to fix my mistakes!

It is trivial to include the croosstool in your bazel project. Simply add the following to your WORKSPACE file:

http_archive(
    name = "murtis_bazel_compilers",
    url = "https://gitlab.com/murtis/bazel_compilers/-/archive/v0.3.0/bazel_compilers-v0.3.0.tar.gz",
    strip_prefix = 'bazel_compilers-v0.3.0',
    sha256 = "f26c7bfd98442b4355803ff4b9f1a8743f8f5da7bdb830d3d625486c1073ad71"
)

load("@murtis_bazel_compilers//compilers:dependencies.bzl", "cross_compiler_dependencies")

cross_compiler_dependencies()

Next, in your .bazelrc file:

build:aarch64 --crosstool_top=@murtis_bazel_compilers//compilers/arm_compiler:toolchain
build:aarch64 --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:aarch64 --cpu=aarch64-linux-gnu --compiler=gcc
build:aarch64 --spawn_strategy=standalone

You can then build with:

~/projects/my_project$ bazel build --config=aarch64 //src:whaterver_the_target

The resultant executable can then be ran on any of the Nvidia Jetson product line.

You can find the code here: https://github.com/curtismuntz/bazel_compilers

Note that my repository also supports compiling for the RaspberryPi product line as well.