Jetson AGX Xavier cross compile on ubuntu

I want to build cross compile platform on host computer(ubuntu x86)
and already clone the clone.img.raw from Jetson AGX Xavier and mount it

I can build jetson_multimedia_api/samples and throw them back to Xavier and run them on target.
Now, I want to cross compile my own package by CMakeList on host computer.

my toolchain.cmake like below


set(tools /home/xxx/aarch64--glibc--stable-final)
set(CMAKE_C_COMPILER ${tools}/bin/aarch64-linux-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-linux-g++)

SET(CMAKE_FIND_ROOT_PATH /home/xxx/aarch64--glibc--stable-final)

but I can’t build them really well because always miss some dependencies like



CMake Error at /usr/local/share/cmake-3.24/Modules/FindCUDAToolkit.cmake:679 (message):
  Could not find nvcc, please set CUDAToolkit_ROOT.
Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)

the problem is ffmpeg and cuda toolkit are existed in clone.img.raw I mounted
but cmake can’t find the path or cmake just find path on host computer?

should I install all dependencies I need on host computer and then I can cross compile
or I need to change some kind of path to let cmake to find dependencies in device where I mount clone.img.raw?

Do you use Jetpack 4 or 5? Would like to know which release you are using.

I already have Jetpack 4.6.2 on Jetson AGX Xavier and I clone image from it to x86 ubuntu20.04

but I individually install L4T Driver Package (BSP) and Sample Root filesystem and CUDA 10.2 on host computer because I can’t install Jetpack 4.6.2 by SDK manager

and now I want to use cmake to build my package but cmake can’t find CUDAToolkit by find_package


Please use the SDK manager to install the CUDA for cross-compiling.
(since JP4.6.2 is a minor update from 4.6.1, please use 4.6.1 if no option for 4.6.2)

SDK manager will install a compatible CUDA library as well as a cross-compiling toolchain.


I don’t have option of JP4.6.1 and 4.6.2 on ubuntu 20.04

For using Jetpack 4, we would suggest have host PC in Ubuntu 18.04.

For Ubuntu 20.04, this probably works:
Jetson Linux API Reference: Setting Up Cross-Platform Support

You may follow the steps and check if you can compile the samples successfully:


The path to nvcc is defined in


# Location of the CUDA Toolkit
CUDA_PATH       := /usr/local/cuda

Ideally this should work since it is linked to nvcc on target. But not sure if it works for cmake. May need to develop Makefile manually.

Hi DaneLLL

I’ve tried Jetpack5.0.2 on ubuntu20.04 and success to cross compile nvidia_multimedia_api examples

I have two questions

  1. now on the Jetson AGX Xavier, the version of Jetpack is 4.6.2, cuda-10.2.
    could I still can install jetpack5.0.2 on host computer ubuntu20.04 and
    do cross compile by mounting the image cloned from Xavier with Jetpack4.6.2?

  2. if do cross compile, those dependency like CUDA, OpenCV should be found in host computer system(/usr/)
    or in clone.img.raw from($jetson/usr/local/cuda-10.2) ?


If you would like to work on Xavier 4.6.2, we would suggest use host Ubuntu 18.04. It may not work properly with 20.04. It would be stable to match Ubuntu version with Jetpack version.

For cross-compiling jetson_multimedia_api samples, we suggest refer to the libs in clone.img.raw, same as suggested in
Jetson Linux API Reference: Setting Up Cross-Platform Support

Just a thought: If the cross compiler and cross linker are the correct version, and the libraries linked against are the mentioned clone.img.raw, then it shouldn’t matter if the host is Ubuntu 20.04 versus 18.04. On the other hand, I too would suggest not tempting problems and sticking with 18.04 on the host PC if this is to be used for developing for an 18.04 Jetson (L4T R32.x, JetPack 4.x). If you already have 20.04, then it is simple enough to find out (well, until something subtle shows up years later, but that might not ever happen).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.