[resolved] How do I debug missing find_package module (CUDAToolkit) on a specific machine?

Hi,

I have a cmake project that is using find_package(CUDAToolkit).
I get this error:

-- Could NOT find CUDAToolkit (missing: CUDAToolkit_DIR)
CMake Error at cmake/find_voreen_libraries.cmake:40 (find_package):
  Could not find a package configuration file provided by "CUDAToolkit" with
  any of the following names:

    CUDAToolkitConfig.cmake
    cudatoolkit-config.cmake

  Add the installation prefix of "CUDAToolkit" to CMAKE_PREFIX_PATH or set
  "CUDAToolkit_DIR" to a directory containing one of the above files.  If
  "CUDAToolkit" provides a separate development package or SDK, be sure it
  has been installed.

To me, it seems like there’s some particularly broken about this system but I don’t know what it could be. I just installed latest stable release of cmake just in case, but I still get the same issue. The modules are there:

/usr/share/cmake-3.20/Help/module/FindCUDAToolkit.rst
/usr/share/cmake-3.20/Modules/FindCUDAToolkit.cmake

but cmake is not finding them.

What should I do next?
The find_package for cudatoolkit works elsewhere (both windows and linux), just not on that machine. So it’s definitely not a typo somewhere.

Eric

This is the output after running with cmake_find_debug_mode

CMake Debug Log at cmake/find_voreen_libraries.cmake:41 (find_package):
    /home/jenkins/miniconda3/envs/dragonfly_development/share/cmake-3.19/CUDAToolkitConfig.cmake
    /home/jenkins/miniconda3/envs/dragonfly_development/share/cmake-3.19/cudatoolkit-config.cmake

  <PackageName>_ROOT CMake variable [CMAKE_FIND_USE_PACKAGE_ROOT_PATH].

    /usr/local/cuda-11.1



  CMAKE_PREFIX_PATH variable [CMAKE_FIND_USE_CMAKE_PATH].

    none

  CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables
  [CMAKE_FIND_USE_CMAKE_PATH].

    none

  Env variable CUDAToolkit_DIR [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].

    none

  CMAKE_PREFIX_PATH env variable [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].

    none

  CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables
  [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].

    none

  Paths specified by the find_package HINTS option.

    /usr/local/cuda
    /usr/local/cuda-11



  Standard system environment variables
  [CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH].

    /
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/libs
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/plugins
    /home/jenkins/workspace/Test environment/cmake_windows_migration/$CONDA_PREFIX
    /home/jenkins/workspace/Test environment/cmake_windows_migration/$PATH
    /home/jenkins/.local
    /home/jenkins/miniconda3/condabin
    /home/jenkins/sonar-scanner/sonar-scanner-4.3.0.2102-linux
    /usr/local
    /usr
    /usr/games
    /usr/local/games
    /snap



  CMake User Package Registry [CMAKE_FIND_USE_PACKAGE_REGISTRY].

    none

  CMake variables defined in the Platform file
  [CMAKE_FIND_USE_CMAKE_SYSTEM_PATH].

    /usr/X11R6
    /usr/pkg
    /opt



  CMake System Package Registry
  [CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY].

    none

  Paths specified by the find_package PATHS option.

    none

  find_package considered the following locations for the Config module:

    /usr/local/cuda-11.1/CUDAToolkitConfig.cmake
    /usr/local/cuda-11.1/cudatoolkit-config.cmake
    /usr/local/cuda/CUDAToolkitConfig.cmake
    /usr/local/cuda/cudatoolkit-config.cmake
    /usr/local/cuda-11/CUDAToolkitConfig.cmake
    /usr/local/cuda-11/cudatoolkit-config.cmake
    /CUDAToolkitConfig.cmake
    /cudatoolkit-config.cmake
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/libs/CUDAToolkitConfig.cmake
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/libs/cudatoolkit-config.cmake
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/plugins/CUDAToolkitConfig.cmake
    /home/jenkins/workspace/build_pipeline_dragonfly/Dragonfly/OrsQtPlateform/plugins/cudatoolkit-config.cmake
    /home/jenkins/.local/CUDAToolkitConfig.cmake
    /home/jenkins/.local/cudatoolkit-config.cmake
    /home/jenkins/miniconda3/condabin/CUDAToolkitConfig.cmake
    /home/jenkins/miniconda3/condabin/cudatoolkit-config.cmake
    /home/jenkins/sonar-scanner/sonar-scanner-4.3.0.2102-linux/CUDAToolkitConfig.cmake
    /home/jenkins/sonar-scanner/sonar-scanner-4.3.0.2102-linux/cudatoolkit-config.cmake
    /usr/local/CUDAToolkitConfig.cmake
    /usr/local/cudatoolkit-config.cmake
    /usr/CUDAToolkitConfig.cmake
    /usr/cudatoolkit-config.cmake
    /usr/games/CUDAToolkitConfig.cmake
    /usr/games/cudatoolkit-config.cmake
    /usr/local/games/CUDAToolkitConfig.cmake
    /usr/local/games/cudatoolkit-config.cmake
    /snap/CUDAToolkitConfig.cmake
    /snap/cudatoolkit-config.cmake
    /opt/CUDAToolkitConfig.cmake
    /opt/cudatoolkit-config.cmake

  The file was not found.

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


CMake Error at cmake/find_voreen_libraries.cmake:41 (find_package):
  Could not find a package configuration file provided by "CUDAToolkit" with
  any of the following names:

    CUDAToolkitConfig.cmake
    cudatoolkit-config.cmake

  Add the installation prefix of "CUDAToolkit" to CMAKE_PREFIX_PATH or set
  "CUDAToolkit_DIR" to a directory containing one of the above files.  If
  "CUDAToolkit" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:124 (include)

No idea what happened. Clearly there are some issues with the environment, but it works now.