# CUDAToolkit cross compile linking error

**URL:** <https://forums.developer.nvidia.com/t/cudatoolkit-cross-compile-linking-error/237137>\
**Category:** Jetson TX2\
**Tags:** ubuntu, kernel, cuda\
**Created:** [December 15, 2022, 1:48am UTC](https://forums.developer.nvidia.com/t/cudatoolkit-cross-compile-linking-error/237137 "2022-12-15T01:48:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike.li3](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mike.li3](https://forums.developer.nvidia.com/u/mike.li3)\
**Post date:** [December 15, 2022, 1:48am UTC](https://forums.developer.nvidia.com/t/cudatoolkit-cross-compile-linking-error/237137/1 "2022-12-15T01:48:15Z")

</div>

I setup the cross-compile environment on x86 for Xavier arm64

I use find\_package in cmake for searching CUDAToolkit  
and it pass but when I run make command  
it occurs error at linking

```auto
[100%] Linking CXX executable testingopencv
/home/gw/cross_compile/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.3.1/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcuda
/usr/local/cuda-10.2/lib64/libnpps.so: error adding symbols: File in wrong format

```

there are two error here, one is compiler cannot find -lcuda and the other is file in wrong format.  
I know the second one is due to point to x86 file rather than arm64 file but I don’t know how to change  
the path. I’ve tried specifying LD\_LIBRARY\_PATH to cuda-10.2/targets/aarch64-linux/lib but it cannot work

thanks for anything idea in advance

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [December 15, 2022, 3:25am UTC](https://forums.developer.nvidia.com/t/cudatoolkit-cross-compile-linking-error/237137/3 "2022-12-15T03:25:22Z")

</div>

Hi,

Here is a related topic that should give you some information.  
Please remember to modify the CUDA version based on your software.

> [@Cmake aarch64 cross compile error](https://forums.developer.nvidia.com/t/cmake-aarch64-cross-compile-error/81348):
>
> Hi, I try to cross compile Cuda code for Jetson Xavier. During the compilation I encounter several problems and currently I am stuck at the " simple test program. " compilation. Thats because the cmake tries to linking the code by using aarch64 gcc instad of nvcc linker, as you can see in the error log below (Code number 3),what cause to the AARCH64 cuda libs to be missing. In addition I try to config the linker flags which seems to be working (code number 2) but I still dose not figure ou…

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [January 4, 2023, 4:30am UTC](https://forums.developer.nvidia.com/t/cudatoolkit-cross-compile-linking-error/237137/5 "2023-01-04T04:30:14Z")

</div>

Closed on January 4, 2023, 4:30am UTC

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