error happend during cross compile in Ubuntu for Jetson ext2(Expecting to find librt for libcudart_s...

When I use cmake to do cross compile Cuda for Jetson ext2 board. I met this problem.
Duda is one of modules in my system.The system is mainly with C.

CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA.cmake:771 (message):
Expecting to find librt for libcudart_static, but didn’t find it.
Call Stack (most recent call first):
dronecuda/CMakeLists.txt:5 (FIND_PACKAGE)

I don’t know about your particular software, but when cross compiling you’ll find that standalone programs (such as a kernel which does not link to anything) are simpler than user space programs (which must use libraries and interact with other components). In the former case you might call it bare metal programming, in the latter user space programming.

That message implies something in the user space environment is missing, e.g., libcudart_static. There are a number of reasons this might be. Consider your host needs a separate set of aarch64/arm64 system files in place separate from its own x86_64 environment, and your cross compile must be set up to find it. This extra is the “sysroot” support. One possibility is the sysroot is incomplete, another possibility is that you need to tell your cross compile where to find it.

What is the output of the following command?

locate libcudart_static
//in case locate is not installed do:
sudo apt-get install mlocate
sudo updatedb
go to step 1

That will determine if you have the file somewhere at the system.

Moreover, it seems that you are compiling a code that you want to execute at Jetson and that will use Cuda [for execution or just for compilation?] However, you may try compile the code at the Jetson itself, since Jetson has Cuda [if you have chosen install Cuda when flashing Jetson from Jetpack]