Hi, I’m working on cross compile but there are some questions
host computer: ubuntu18.04 (jetpack 4.6.2)
target device: Jetson AGX Xavier(jetpack 4.6.2)
before build my own code, I can successfully build example code from jetson_multimedia_api by mounting
the clone.img.raw from cloning target device.
I build code by CMakeLists.txt and Toolchain.cmake for cross compile
the configuration of Toolchain like below
/home/gw/jetson is where I mount clone.img.raw
set(CMAKE_SYSTEM_NAME Linux)
########### CROSS COMPILER GCC 9 ###############################
# which C and C++ compiler to use
set(CMAKE_C_COMPILER /home/gw/aarch64--glibc--stable-final/bin/aarch64-linux-gcc)
set(CMAKE_CXX_COMPILER /home/gw/aarch64--glibc--stable-final/bin/aarch64-linux-g++)
################################################################################
set(CMAKE_FIND_ROOT_PATH /home/gw/jetson
/home/gw/jetson/usr/local
/home/gw/jetson/usr/lib/aarch64-linux-gnu/cmake/opencv4
/home/gw/jetson/usr/lib/aarch64-linux-gnu)
set(CUDA_TOOLKIT_ROOT_DIR /home/gw/jetson/usr/local/cuda-10.2
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
and the execute cmake toolchain.cmake …
the Error code is below
-- Unable to find cuda_runtime.h in "/usr/local/cuda/targets//include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cublas_v2.h in either "" or "/usr/local/math_libs/include"
-- Unable to find cudart library.
CMake Error at /home/gw/cmake-3.24.3/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR CUDA_CUDART)
(found version "10.2.300")
Call Stack (most recent call first):
/home/gw/cmake-3.24.3/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/home/gw/cmake-3.24.3/Modules/FindCUDAToolkit.cmake:818 (find_package_handle_standard_args)
CMakeLists.txt:48 (find_package)
I am stuck in here, I could find cuda_runtime.h in
/usr/local/cuda-10.2/targets/aarch64-linux/include or
/usr/local/cuda-10.2/targets/x86_64-linux/include or
/home/gw/jetson/usr/local/cuda-10.2/targets/aarch64-linux/include
but cmake is unable to find it by find_package(CUDAToolkit REQUIRED)
Hi, thanks for your reply
as you said, I specified the path to CUDAToolkit_ROOT=/home/gw/jetson/usr/local/cuda-10.2
but still can’t work
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/gw/aarch64--glibc--stable-final/bin/aarch64-linux-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/gw/aarch64--glibc--stable-final/bin/aarch64-linux-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:18 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
CMake variable CUDAToolkit_ROOT is set to:
/home/gw/jetson/usr/local/cuda-10.2
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
/lib/ld-linux-aarch64.so.1: No such file or directory
-- Unable to find cuda_runtime.h in "/home/gw/jetson/usr/local/cuda-10.2/targets//include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cublas_v2.h in either "" or "/home/gw/jetson/usr/local/math_libs/include"
-- Unable to find cudart library.
CMake Error at /home/gw/cmake-3.24.3/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR CUDA_CUDART)
Call Stack (most recent call first):
/home/gw/cmake-3.24.3/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/home/gw/cmake-3.24.3/Modules/FindCUDAToolkit.cmake:818 (find_package_handle_standard_args)
CMakeLists.txt:18 (find_package)
-- Configuring incomplete, errors occurred!
In general, the CUDA library should be installed under /usr/loca/cuda/.
But it seems that you have a CUDA installed under home/gw/jetson/usr/local/cuda/ as well.