Link error in cross compilation of opencv 4.2.0 using cuda 11.4

link error in cross compilation of opencv 4.2.0 using cuda 11.4

I want to run a unittest on orin, where there is functional dependency of opencv 4.2.0. The compilation of my unittest was ok, but the link failed as following. Has any one has an idea about this?

Thanks in advance.

[100%] Linking CXX executable PPunittest

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppc.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppial.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppicc.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppidei.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppif.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppig.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppim.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppist.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppisu.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnppitc.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libnpps.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libcublas.so.11, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: warning: libcufft.so.10, needed by /home/orin/opencv_4.2.0/lib/libopencv_gapi.so.4.2.0, not found (try using -rpath or -rpath-link)

/opt/toolchains/linux-toolchain-aarch64/bin/…/lib/gcc/aarch64-linux-gnu/4.9.4/…/…/…/…/aarch64-linux-gnu/bin/ld: error in /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart_static.a(cudart_static.o)(.eh_frame); no .eh_frame_hdr table will be created.

Hi,
Please try this script:
Compiling OpenCV on Jetpack 5 - #5 by AastaLLL

ok, thanks.

Is there a solution to opencv cross compilation on linux?

I cross compiled opencv 4.4.0/4.5.0/4.6.0 on ubuntu 18.04 with nvcc 11.4, what i got were as following:

CMake Warning at cmake/OpenCVFindLibsPerf.cmake:45 (message):
OpenCV is not able to find/configure CUDA SDK (required by WITH_CUDA).

CUDA support will be disabled in OpenCV build.

To eliminate this warning remove WITH_CUDA=ON CMake configuration option.

Call Stack (most recent call first):
CMakeLists.txt:688 (include)

The command i used is “cmake -D CMAKE_TOOLCHAIN_FILE=…/platforms/linux/aarch64-gnu.toolchain.cmake -D WITH_CUDA=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN=“7.2,8.
7” -D CUDA_ARCH_PTX=”" -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib/modules -D WITH_GSTREAMER=ON
-D WITH_LIBV4L=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELE
ASE -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4/ -D CMAKE_INSTALL_PREFIX=…/aarch_64_install …"

Hi,
You mayset up the environment to successfully build it on Orin developer kit first. And then refer to the steps in
Jetson Linux API Reference: Setting Up Cross-Platform Support | NVIDIA Docs

It is to clone the image and mount to the host. If you can build it on Jetson platform, it should work by mounting the same environment on the host.

thanks, I will try it.