microsoft / microsoft/onnxruntime

Build / CMake can't find nvcc

Open
#8,933 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build contributions welcome ep:CUDA
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Describe the bug
I'm trying to build the ONNX Runtime on Ubuntu 20.04, with CUDA 11.4 installed from the https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 apt repo, but it fails to find nvcc, even though I'm passing --cuda_home

-- 
-- ******** Summary ********
--   CMake version             : 3.21.2
--   CMake command             : /home/spike/Applications/cmake/bin/cmake
--   System                    : Linux
--   C++ compiler              : /usr/bin/c++
--   C++ compiler version      : 9.3.0
--   CXX flags                 :  -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED -Wnon-virtual-dtor
--   Build type                : RelWithDebInfo
--   Compile definitions       : ENABLE_ORT_FORMAT_LOAD;ORT_ENABLE_ORT_FORMAT_RUNTIME_GRAPH_OPTIMIZATION;EIGEN_MPL2_ONLY;PLATFORM_POSIX
--   CMAKE_PREFIX_PATH         : 
--   CMAKE_INSTALL_PREFIX      : /usr/local
--   CMAKE_MODULE_PATH         : /home/spike/repos/onnxruntime/cmake/external
-- 
--   ONNX version              : 1.10.1
--   ONNX NAMESPACE            : onnx
--   ONNX_USE_LITE_PROTO       : ON
--   USE_PROTOBUF_SHARED_LIBS  : OFF
--   Protobuf_USE_STATIC_LIBS  : ON
--   ONNX_DISABLE_EXCEPTIONS   : OFF
--   ONNX_WERROR               : OFF
--   ONNX_BUILD_TESTS          : OFF
--   ONNX_BUILD_BENCHMARKS     : OFF
--   ONNXIFI_DUMMY_BACKEND     : OFF
--   ONNXIFI_ENABLE_EXT        : OFF
-- 
--   Protobuf compiler         : 
--   Protobuf includes         : 
--   Protobuf libraries        : 
--   BUILD_ONNX_PYTHON         : OFF
CMake Error at /home/spike/Applications/cmake/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake:741 (message):
  Compiling the CUDA compiler identification source file
  "CMakeCUDACompilerId.cu" failed.

  Compiler: /usr/bin/nvcc

  Build flags:

  Id flags: -v

  

  The output was:

  No such file or directory

  

  

Call Stack (most recent call first):
  /home/spike/Applications/cmake/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /home/spike/Applications/cmake/share/cmake-3.21/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
  /home/spike/Applications/cmake/share/cmake-3.21/Modules/CMakeDetermineCUDACompiler.cmake:283 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:1465 (enable_language)

Urgency
Blocked

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntun 20.04
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: 1.8.2
  • Python version: 3.8.10
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source): Ubuntu 9.3.0-17ubuntu1~20.04
  • CUDA/cuDNN version: 11.4 / 8.2.2
  • GPU model and memory: RTX 2080 Ti

To Reproduce
Installed cmake to /home/spike/Applications/cmake and have /home/spike/Applications/cmake/bin on my path.
Added /usr/local/cuda/bin to my path, since the cuda package doesn't add nvcc it to /usr/bin

$ which nvcc
/usr/local/cuda/bin/nvcc

Building with

./build.sh --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_cuda --config RelWithDebInfo --build_shared_lib --parallel

Expected behavior
Builds and finds CUDA install at /usr/local/cuda

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build.sh and CMakeLists.txt around line 1465, then inspect the CMake compiler-identification failure shown in the report. Reproduce the CUDA build using the stated Ubuntu, CMake, CUDA, and --cuda_home settings, and confirm that the build locates nvcc at /usr/local/cuda/bin and proceeds past compiler detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.