Fail to run the Two Days to a Demo on Xavier


I just followed the instruction of “How to install Jetpack” to install the target device, Jetson Xavier, and tried to build the source on Jetson following the “Two Days to a Demo” tutorial. However, the following error makes the process incompleted, while the command of “cmake …/” is executed,

CUDA_TOOLKIT_ROOT_DIR not found or specified
-- CUDA version: 
-- system arch:  aarch64
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
    linked by target "jetson-inference" in directory /home/nvidia/Downloads/jetson-inference

It seems that the CUDA is not found, but I am sure that the “CUDA Toolkit” in “install on Target” is selected while the is installed.

Could someone help provide any comments? Thanks a lot.

you needed to install cuda to jetson with jetpack somehow,
what does return the command below if executed at jetson?


Hi tingying.wu,

Have you installed the CUDA libraries for the Jetson AGX using Jetpack-4.1.1 from a host computer? You’ll need to do this first.

After that you should ensure that your ~/.bashrc file contains environment variables LD_LIBRARY_PATH that points to the cuda libraries and PATH points to the nvcc compiler?

For example:

export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}

On my Jetson AGX, I get the following output:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sun_Aug_12_21:08:25_CDT_2018
Cuda compilation tools, release 10.0, V10.0.117

Hi elvis.dowson,

Thanks a lot for your reply.
Yes, I installed Jetpack-4.1.1 from a host computer.

I also followed your instruction to copy-and-paste the path to the ~/.bashrc file, but the “nvcc --version” command returned “bash: nvcc: command not found”. I also found that I could not find the folder “/usr/local/cuda”. I guess that the CUDA is not correctly installed on the Jetson AGX. However, I pretty sure that the CUDA should be flashed on the Jetson AGX Xavier because while installing from a host computer it shows:

Ready to flash and/or set up your Jetson AGX Xavier

Following actions will be performed at this stage.

-Flash OS to Jetson AGX Xavier device
-Push and install 64Bit CUDA on target
-Push and install TensorRT on target
-Push and install 64Bit cuDNN on target
-Cross-compile 64Bit CUDA samples and push to target
-Push and install 64Bit OpenCV on target
-Push and install MMAPI on target
-Push and install 64Bit VisionWorks on target
-Push and install 64Bit VisionWorks SFM on target
-Push and install 64Bit VisionWorks Tracking on target

Why is the CUDA folder not found on the Jetson AGX? What step did I miss during the installation process? Do you have any idea? Thanks again for your help

You can try re-flashing your Jetson AGX once again with JetPack-4.4.1, after you’ve backup your files and settings.

Alternatively, you can try to run the following script, to manually download and install all CUDA 10 for arm64 libraries directly onto the Jetson AGX platform:


export JETPACK_VERSION='4.4.1'
export CUDA_VERSION='10.0'
export OPENCV_VERSION='3.3.1'
export TENSORRT_VERSION='5.0.3'

# download and install nvidia cuda driver package
if [ "$BUILD_VERSION" = "10.0"   ]; then \
      echo "downloading cuda-$BUILD_VERSION" ; \
      export URL="" ; \
      curl $URL/cuda-repo-l4t-10-0-local-10.0.117_1.0-1_arm64.deb -#o cuda-repo-l4t_arm64.deb; \
      curl $URL/libcudnn7_7.3.1.20-1+cuda10.0_arm64.deb           -#o libcudnn_arm64.deb; \
      curl $URL/libcudnn7-dev_7.3.1.20-1+cuda10.0_arm64.deb       -#o libcudnn-dev_arm64.deb; \
      curl $URL/libcudnn7-doc_7.3.1.20-1+cuda10.0_arm64.deb       -#o libcudnn-doc_arm64.deb; \
    else \
      echo "error: please specify correct cuda version in" ; \
      exit 1 ; \
    fi \
    && echo "installing cuda-$BUILD_VERSION" \
    && DEBIAN_FRONTEND=noninteractive TERM=linux apt-get install --no-install-recommends -q -y \
    ./cuda-repo-l4t_arm64.deb \
    && apt-key add /var/cuda-repo-10-0-local-10.0.117/ \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive TERM=linux apt-get install --no-install-recommends -q -y \
    cuda-toolkit-10.0 \
    ./libcudnn_arm64.deb \
    ./libcudnn-dev_arm64.deb \
    ./libcudnn-doc_arm64.deb \
    && rm -rf /var/cuda-repo-10-0-local-10.0.117/*.deb \
    && rm -rf /tmp/*.deb \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

# download and install nvidia tensor rt package
if [ "$TENSORRT_VERSION" = "5.0.3" ] && [ "$BUILD_VERSION" = "10.0" ]; then \
      echo "downloading tensorrt-$TENSORRT_VERSION" ; \
      export URL="" ; \
      curl $URL/libnvinfer5_5.0.3-1+cuda10.0_arm64.deb       -#o libnvinfer_arm64.deb; \
      curl $URL/libnvinfer-dev_5.0.3-1+cuda10.0_arm64.deb    -#o libnvinfer-dev_arm64.deb; \
      curl $URL/libnvinfer-samples_5.0.3-1+cuda10.0_all.deb  -#o libnvinfer-samples_arm64.deb; \
      curl $URL/tensorrt_5.0.3.2-1+cuda10.0_arm64.deb        -#o tensorrt_arm64.deb; \
      curl $URL/libgie-dev_5.0.3-1+cuda10.0_all.deb          -#o libgie-dev_arm64.deb; \
    else \
      echo "info: skipping nvidia tensor rt package installation" ; \
    fi \
    && echo "installing tensorrt-$TENSORRT_VERSION" \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive TERM=linux apt-get install --no-install-recommends -q -y \
    ./libnvinfer_arm64.deb \
    ./libnvinfer-dev_arm64.deb \
    ./libnvinfer-samples_arm64.deb \
    ./tensorrt_arm64.deb \
    ./libgie-dev_arm64.deb \
    && rm -rf /var/cuda-repo-10-0-local-10.0.117/*.deb \
    && rm -rf /tmp/*.deb \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

# download and install nvidia opencv package
if [ "$OPENCV_VERSION" = "3.3.1"   ]; then \
      echo "downloading opencv-$OPENCV_VERSION" ; \
      export URL="" ; \
      curl $URL/libopencv_3.3.1_arm64.deb         -#o libopencv_arm64.deb; \
      curl $URL/libopencv-dev_3.3.1_arm64.deb     -#o libopencv-dev_arm64.deb; \
      curl $URL/libopencv-python_3.3.1_arm64.deb  -#o libopencv-python_arm64.deb; \
      curl $URL/libopencv-samples_3.3.1_arm64.deb -#o libopencv-samples_arm64.deb; \
    else \
      echo "info: skipping nvidia opencv package installation" ; \
    fi \
    && echo "installing opencv-$OPENCV_VERSION" \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive TERM=linux apt-get install --no-install-recommends -q -y \
    ./libopencv_arm64.deb \
    ./libopencv-dev_arm64.deb \
    ./libopencv-python_arm64.deb \
    ./libopencv-samples_arm64.deb \
    && rm -rf /var/cuda-repo-10-0-local-10.0.117/*.deb \
    && rm -rf /tmp/*.deb \
    #&& apt-mark hold libopencv libopencv-dev libopencv-python libopencv-samples \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

# download and install nvidia visionworks package
if [ "$VISIONWORKS_VERSION" = "1.6"   ]; then \
      echo "downloading visionworks-$VISIONWORKS_VERSION" ; \
      export URL="" ; \
      curl $URL/libvisionworks-repo_1.6.0.500n_arm64.deb      -#o libvisionworks_arm64.deb; \
      curl $URL/libvisionworks-sfm-repo_0.90.3_arm64.deb      -#o libvisionworks-sfm_arm64.deb; \
      curl $URL/libvisionworks-tracking-repo_0.88.2_arm64.deb -#o libvisionworks-tracking_arm64.deb; \
    else \
      echo "info: skipping nvidia visionworks package installation" ; \
    fi \
    && echo "installing visionworks-$VISIONWORKS_VERSION" \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive TERM=linux apt-get install --no-install-recommends -q -y \
    ./libvisionworks_arm64.deb \
    ./libvisionworks-sfm_arm64.deb \
    ./libvisionworks-tracking_arm64.deb \
    && rm -rf /var/visionworks-repo/*.deb \
    && rm -rf /var/visionworks-sfm-repo/*.deb \
    && rm -rf /var/visionworks-tracking-repo/*.deb \
    && rm -rf /tmp/*.deb \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

# download nvidia tegra multimedia-api package
if [ "$MULTIMEDIA_API_VERSION" = "31.1.0"   ]; then \
      echo "downloading nvidia tegra multimedia-api-$MULTIMEDIA_API_VERSION" ; \
      export URL="" ; \
      wget -qO- $URL/Tegra_Multimedia_API_R31.1.0_aarch64.tbz2 | \
      tar -xvj -C /opt/nvidia/ ; \
    else \
      echo "info: skipping nvidia tegra multimedia-api package installation" ; \