Building driveworks samples on host. Cmake error Cuda_add_library

Hi,

I have been following the doc for cross compiling the sample at

file:///usr/local/driveworks/doc/nvdwx_html/dwx_samples_building.html#cross-compilation

I cannot run the cmake for any samples giving the error as below:

/build$ cmake -DCMAKE_BUILD_TYPE=Release /usr/local/driveworks/samples/src/drivenet
– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is GNU 5.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Error at common/CMakeLists.txt:23 (cuda_add_library):
Unknown CMake command “cuda_add_library”.

CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.2)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run “cmake --help-policy CMP0000”.
This warning is for project developers. Use -Wno-dev to suppress it.

– Configuring incomplete, errors occurred!
See also “/home/saq/build/CMakeFiles/CMakeOutput.log”.

My Cmake version is 3.2.3

Any suggestions!

Regards,
Saq

Hi,

Seems you run cmake not on the top level CMakeLists.txt which is located at /usr/local/driveworks/samples/CMakeLists.txt. Try to run

cmake /usr/local/driveworks/samples .
make

from a build directory. Each sample is not self-contained cmake project and if you want to build specific sample, specify it as target for make after cmake configuration.

Hi,

I ran the cmake on top level as you mentioned (/usr/local/driveworks/samples) . However,I got the below errors:

saq@saq-XPS:/usr/local/driveworks-0.3/samples$ cmake /usr/local/driveworks/samples .
CMake Warning at cmake/SamplesSetBuildType.cmake:19 (message):
CMAKE_BUILD_TYPE not defined. Using Release as default.
Call Stack (most recent call first):
CMakeLists.txt:9 (include)

CMake Error at /usr/local/share/cmake-3.2/Modules/CMakeDetermineSystem.cmake:175 (file):
file failed to open for writing (No such file or directory):

/usr/local/driveworks-0.3/samples/CMakeFiles/CMakeOutput.log

Call Stack (most recent call first):
CMakeLists.txt:17 (project)

CMake Error: Could not open file for write in copy operation /usr/local/driveworks-0.3/samples/CMakeFiles/3.2.3/CMakeSystem.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error at /usr/local/share/cmake-3.2/Modules/CMakeDetermineSystem.cmake:187 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:17 (project)

CMake Error at /usr/local/share/cmake-3.2/Modules/CMakeDetermineCompilerId.cmake:125 (file):
file problem creating directory:
/usr/local/driveworks-0.3/samples/CMakeFiles/3.2.3/CompilerIdC
Call Stack (most recent call first):
/usr/local/share/cmake-3.2/Modules/CMakeDetermineCompilerId.cmake:39 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/usr/local/share/cmake-3.2/Modules/CMakeDetermineCCompiler.cmake:108 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:17 (project)

I then run the cmake on /usr/local/driveworks/samples/src/ .
CMake Error: The source directory “/usr/local/driveworks-0.3/samples/src” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

I then copied the CmakeList.txt inside the src directory but still no luck.

saq@saq-XPS:/usr/local/driveworks-0.3/samples/src$ cmake /usr/local/driveworks/samples/src/ .
CMake Error at CMakeLists.txt:9 (include):
  include could not find load file:

    SamplesSetBuildType


CMake Error at /usr/local/share/cmake-3.2/Modules/CMakeDetermineSystem.cmake:175 (file):
  file failed to open for writing (No such file or directory):

    /usr/local/driveworks-0.3/samples/src/CMakeFiles/CMakeOutput.log
Call Stack (most recent call first):
  CMakeLists.txt:17 (project

Below is my directory structure:

saq@saq-XPS:/usr/local/driveworks-0.3/samples/src$ tree /usr/local/driveworks/samples
/usr/local/driveworks/samples

├── cmake
│   ├── ArchConfiguration.cmake
│   ├── CMakeParseArguments.cmake
│   ├── CommonConfiguration.cmake
│   ├── FindCUDA
│   │   ├── make2cmake.cmake
│   │   ├── parse_cubin.cmake
│   │   ├── run_nvcc.cmake
│   │   └── run_nvcc_deps.cmake
│   ├── FindCUDA.cmake
│   ├── FindDriveworks.cmake
│   ├── FindEGL.cmake
│   ├── FindPackageHandleStandardArgs.cmake
│   ├── FindPackageMessage.cmake
│   ├── LibFindMacros.cmake
│   ├── Samples3rdparty.cmake
│   ├── SamplesConfiguration.cmake
│   ├── SamplesInstallConfiguration.cmake
│   ├── SamplesSetBuildType.cmake
│   └── Toolchain-V4L.cmake
├── CMakeLists.txt
├── README.md
└── src
├── CMakeLists.txt
├── colorcorrection
│   ├── CMakeLists.txt
│   ├── main.cpp
│   └── README.md
├── common
│   ├── Checks.hpp
│   ├── CMakeLists.txt
│   ├── ConsoleColor.cpp
│   ├── ConsoleColor.hpp
│   ├── CudaTimer.hpp
│   ├── DataPath.hpp.in
│   ├── GPUProgram.cpp
│   ├── GPUProgram.hpp
│   ├── Grid.cpp
│   ├── Grid.hpp
│   ├── Mat4.hpp
│   ├── MathUtils.cpp
│   ├── MathUtils.hpp
│   ├── MouseView3D.cpp
│   ├── MouseView3D.hpp
│   ├── ProfilerCUDA.cpp
│   ├── ProfilerCUDA.hpp
│   ├── ProgramArguments.cpp
│   ├── ProgramArguments.hpp
│   ├── SampleFramework.cpp
│   ├── SampleFramework.hpp
│   ├── Shader.cpp
│   ├── Shader.hpp
│   ├── StatsCounter.hpp
│   ├── VBO.cpp
│   ├── VBO.hpp
│   ├── WindowEGL.cpp
│   ├── WindowEGL.hpp
│   ├── WindowGLFW.cpp
│   ├── WindowGLFW.hpp
│   └── Window.hpp
├── dnn
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.2.3
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── a.out
│   │   │   │   └── CMakeCCompilerId.c
│   │   │   └── CompilerIdCXX
│   │   │   ├── a.out
│   │   │   └── CMakeCXXCompilerId.cpp
│   │   ├── cmake.check_cache
│   │   ├── CMakeOutput.log
│   │   ├── CMakeTmp
│   │   ├── feature_tests.bin
│   │   ├── feature_tests.c
│   │   └── feature_tests.cxx
│   ├── CMakeLists.txt
│   ├── dnn_common
│   │   ├── CMakeFiles
│   │   ├── CMakeLists.txt
│   │   ├── DNNInference.cpp
│   │   ├── DNNInference.hpp
│   │   ├── ISensorIO.hpp
│   │   ├── SensorIOCuda.cpp
│   │   ├── SensorIOCuda.hpp
│   │   ├── SensorIONvmedia.cpp
│   │   └── SensorIONvmedia.hpp
│   ├── sample_object_detector
│   │   ├── CMakeLists.txt
│   │   ├── main.cpp
│   │   └── README.md
│   ├── sample_object_dwdetector
│   │   ├── CMakeLists.txt
│   │   ├── main.cpp
│   │   └── README.md
│   └── sample_object_tracker
│   ├── CMakeLists.txt
│   ├── FeatureTracker2D.cpp
│   ├── FeatureTracker2D.hpp
│   ├── main.cpp
│   └── README.md

To shorten the comment I have removed other sample folders.

Hi,

Cmake takes two arguments:

  1. Path to sources
  2. Path to build directory

Building code in sources path is not a good practice. Use both arguments and build it outside the source tree (for example, somewhere in your home). Run that command in build directory.

Also check your cmake installation. For some reason it looks for its modules at /usr/local/share instead of /usr/share. Where is it installed?

Hi,

I created a new build folder inside Documents and ran the cmake on top of samples folder. It run successfully without any errors and created the compiled files.

Cmake was present at /usr/local/share/cmake-3.2 . However, there was a different version at /usr/share/cmake-3.5 which I think was not used as my system recognised cmake-3.2.3

Thanks for the suggestions.