Cuda_kde_depth_packet_processor.cu:39:10: fatal error: helper_math.h: File or directory not found

Hello.

I want that my Kinect 2 is recognized as webcam on ubuntu 21.10 + nvidia driver 470.86 + cuda 11.4 :

marietto-BHYVE:/home/marietto# nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:15:13_PDT_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0

marietto-BHYVE:/home/marietto/Scrivania/libfreenect2# nvidia-smi

| NVIDIA-SMI 470.86       Driver Version: 470.86       CUDA Version: 11.4

To accomplish the task I’ve followed this tutorial :

and I have issued the following commands :

git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2
mkdir build && cd build
cmake ..

but at some point,I’ve got this error :

marietto-BHYVE:/home/marietto/Scrivania/libfreenect2/build# make

-- using tinythread as threading library
-- Could NOT find TegraJPEG (missing: TegraJPEG_INCLUDE_DIRS TegraJPEG_WORKS) 
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindOpenGL.cmake:305 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
  FindOpenGL found both a legacy GL library:
    OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
  and GLVND libraries for OpenGL and GLX:
    OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  CMakeLists.txt:269 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Linking with these libraries: 
 /usr/lib/x86_64-linux-gnu/libusb-1.0.so
 pthread
 va-drm
 va
 /usr/lib/x86_64-linux-gnu/libjpeg.so
 /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0
 /usr/lib/x86_64-linux-gnu/libglfw.so
 /usr/lib/x86_64-linux-gnu/libGL.so
 /usr/lib/x86_64-linux-gnu/libOpenCL.so
 /usr/lib/x86_64-linux-gnu/libcudart_static.a
 Threads::Threads
 dl
 /usr/lib/x86_64-linux-gnu/librt.a
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configurating examples
-- Using in-tree freenect2 target
-- Feature list:
--   CUDA    yes
--   CXX11    disabled
--   Examples    yes
--   OpenCL    yes
--   OpenGL    yes
--   OpenNI2    yes
--   TegraJPEG    no
--   Threading    tinythread
--   TurboJPEG    yes
--   VAAPI    yes
--   VideoToolbox    no (Apple only)
--   streamer_recorder    disabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/marietto/Scrivania/libfreenect2/build
[  4%] Built target generate_resources_tool
[  7%] Building NVCC (Device) object CMakeFiles/cuda_compile_1.dir/src/cuda_compile_1_generated_cuda_kde_depth_packet_processor.cu.o
/home/marietto/Scrivania/libfreenect2/src/cuda_kde_depth_packet_processor.cu:39:10: fatal error: helper_math.h: File o directory non esistente
   39 | #include <helper_math.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
CMake Error at cuda_compile_1_generated_cuda_kde_depth_packet_processor.cu.o.RelWithDebInfo.cmake:220 (message):
  Error generating
  /home/marietto/Scrivania/libfreenect2/build/CMakeFiles/cuda_compile_1.dir/src/./cuda_compile_1_generated_cuda_kde_depth_packet_processor.cu.o
make[2]: *** [CMakeFiles/freenect2.dir/build.make:411: CMakeFiles/cuda_compile_1.dir/src/cuda_compile_1_generated_cuda_kde_depth_packet_processor.cu.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:194: CMakeFiles/freenect2.dir/all] Errore 2
make: *** [Makefile:149: all] Errore 2

it can’t continue the compilation because It can’t find the file helper_math.h in the proper place. At this point I’m confused. I don’t know where can I get that file and where should I place it. I imagine that I should install the cuda samples and I tried,as u can see below,getting the cuda package for ubuntu 20.04 (im running 21.10,so I’ve thought that 20.04 was good,since it is the closest to my ubuntu version),and I’ve deselected everything except the samples,but it didn’t work :

marietto-BHYVE:/home/marietto/Scrivania# chmod +x cuda_11.6.0_510.39.01_linux.run

marietto-BHYVE:/home/marietto/Scrivania# ./cuda_11.6.0_510.39.01_linux.run

===========
= Summary =
===========
Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.6/
Please make sure that
 -   PATH includes /usr/local/cuda-11.6/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.6/lib64, or, add /usr/local/cuda-11.6/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.6/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 510.00 is required for CUDA 11.6 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver
Logfile is /var/log/cuda-installer.log

as a further experiment,I tried to install the samples from the cuda version below :

http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run

but :

[INFO]: Driver installation detected by command: apt list --installed | grep -e nvidia-driver-[0-9][0-9][0-9] -e >
[INFO]: Cleaning up window
[INFO]: Complete
[INFO]: Checking compiler version...
[INFO]: gcc location: /usr/bin/gcc
[INFO]: gcc version: gcc version 10.3.0 (Ubuntu 10.3.0-11ubuntu1)
[ERROR]: unsupported compiler version: 10.3.0. Use --override to override this check.

As further tries,I tried different versions of cuda 11.3 and 11.4 packages :

cuda-11-3_11.3.0-1_amd64.deb 4.0KB 2021-03-26 22:54
cuda-11-3_11.3.1-1_amd64.deb 4.0KB 2021-05-14 01:12
cuda-11-4_11.4.0-1_amd64.deb 4.0KB 2021-06-24 02:48
cuda-11-4_11.4.1-1_amd64.deb 4.0KB 2021-07-28 19:46
cuda-11-4_11.4.2-1_amd64.deb 4.0KB 2021-08-30 21:01
cuda-11-4_11.4.3-1_amd64.deb 4.0KB 2021-10-29 16:46

,but everytime it won’t install only the samples without the driver. I don’t want to reinstall the driver,since it works ; I don’t want to break the system ;

At the end I’ve installed the cuda samples using this tutorial :

they have been installed correctly,without giving any error,but it stills can’t find the helper_math.h file , giving the same error as before.

what should I do ? thanks.

On a proper CUDA install where you have also included the CUDA samples, helper_math.h is available at /usr/loca/cuda/samples/common/inc`. I can think of two possibilities:

  1. You didn’t install the samples (correctly, in the right place, etc.).
  2. Your cmake apparatus is messed up (looking in the wrong place).

I’m not familiar with snapcraft and personally would not use that for anything related to CUDA installs. I generally recommend people use the CUDA linux install guide provided by NVIDIA, and get their cuda installers from https://www.nvidia.com/getcuda

The install guide is linked from that page.

I’ve installed CUDA toolkit 11.5 and it has installed also the nvidia driver 495,but,since the file nvcc is missing on my system,I should install the cuda-toolkit from the ubuntu packages,but then it wants to install the driver version 470 and this is a problem,because at the same time it wants to remove the driver 495. I imagine that with the CUDA toolkit 11.6 the situation is even worse,because it is newer than 11.5. Whats the solution for this ?

A correctly installed CUDA toolkit always comes with nvcc. Did you update your PATH variable correctly?
On my machine, nvcc is located at /usr/local/cuda-11.5/bin

The CUDA samples Rovert_Crovella is referring to are available on github. GitHub - NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit
Note that starting with CUDA 11.6 , the samples are no longer shipped together with the CUDA toolkit.

can you tell me how can I update the CUDA path ? what’s the correct command line ?

I tried to compile the CUDA sample from source code and I’ve got these errors :

root@marietto-BHYVE:/home/marietto/Scrivania/CUDA/cuda-samples# make

nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). graphMemoryFootprint.cu(41): error: identifier "cudaGraphMemAttributeType" is undefined

graphMemoryFootprint.cu(41): error: expected a ")"

graphMemoryFootprint.cu(41): error: identifier "cudaDeviceGetGraphMemAttribute" is undefined

graphMemoryFootprint.cu(41): error: no instance of function template "check" matches the argument list argument types are: (<error-type>)

graphMemoryFootprint.cu(41): error: expected a ";"

graphMemoryFootprint.cu(46): error: incomplete type is not allowed

graphMemoryFootprint.cu(46): error: identifier "cudaMemAllocNodeParams" is undefined

graphMemoryFootprint.cu(46): error: identifier "allocParams" is undefined

graphMemoryFootprint.cu(46): error: type name is not allowed

graphMemoryFootprint.cu(46): error: expected a ")"

graphMemoryFootprint.cu(47): error: expected a ";"

graphMemoryFootprint.cu(75): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(76): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(78): error: expected a declaration

graphMemoryFootprint.cu(85): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(87): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(87): error: declaration is incompatible with function template "void check(T, const char *, const char *, int)" ../../../Common/helper_cuda.h(583): here

graphMemoryFootprint.cu(87): error: identifier "graphExec" is undefined

graphMemoryFootprint.cu(87): error: identifier "graph" is undefined

graphMemoryFootprint.cu(87): error: too many initializer values

graphMemoryFootprint.cu(88): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(88): error: variable "check" has already been defined

graphMemoryFootprint.cu(88): error: too many initializer values

graphMemoryFootprint.cu(89): error: expected a declaration

graphMemoryFootprint.cu(108): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(109): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(109): error: variable "check" has already been defined

graphMemoryFootprint.cu(109): error: identifier "stream" is undefined

graphMemoryFootprint.cu(109): error: too many initializer values

graphMemoryFootprint.cu(110): error: expected a declaration

graphMemoryFootprint.cu(157): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(159): error: identifier "time_clocks" is undefined

graphMemoryFootprint.cu(161): error: identifier "numElements" is undefined

graphMemoryFootprint.cu(162): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(162): error: expected a ";"

graphMemoryFootprint.cu(163): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(163): error: variable "blockDeviceNodeParams" has already been defined

graphMemoryFootprint.cu(163): error: expected a ";"

graphMemoryFootprint.cu(164): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(164): error: variable "blockDeviceNodeParams" has already been defined

graphMemoryFootprint.cu(164): error: expected a ";"

graphMemoryFootprint.cu(165): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(165): error: variable "blockDeviceNodeParams" has already been defined

graphMemoryFootprint.cu(165): error: expected a ";"

graphMemoryFootprint.cu(165): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(166): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(166): error: variable "blockDeviceNodeParams" has already been defined

graphMemoryFootprint.cu(166): error: expected a ";"

graphMemoryFootprint.cu(167): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(167): error: variable "blockDeviceNodeParams" has already been defined

graphMemoryFootprint.cu(167): error: expected a ";"

graphMemoryFootprint.cu(168): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(168): error: variable "check" has already been defined

graphMemoryFootprint.cu(168): error: identifier "blockDeviceNode" is undefined

graphMemoryFootprint.cu(168): error: identifier "allocNodeA" is undefined

graphMemoryFootprint.cu(168): error: argument of type "int *" is incompatible with parameter of type "const cudaKernelNodeParams *"

graphMemoryFootprint.cu(168): error: too many initializer values

graphMemoryFootprint.cu(171): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(171): error: variable "check" has already been defined

graphMemoryFootprint.cu(171): error: identifier "freeNodeA" is undefined

graphMemoryFootprint.cu(171): error: identifier "dPtr" is undefined

graphMemoryFootprint.cu(171): error: identifier "cudaGraphAddMemFreeNode" is undefined

graphMemoryFootprint.cu(171): error: too many initializer values

graphMemoryFootprint.cu(174): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(174): error: variable "check" has already been defined

graphMemoryFootprint.cu(174): error: too many initializer values

graphMemoryFootprint.cu(175): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(175): error: variable "check" has already been defined

graphMemoryFootprint.cu(175): error: too many initializer values

graphMemoryFootprint.cu(176): error: expected a declaration

graphMemoryFootprint.cu(197): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(199): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(199): error: variable "check" has already been defined

graphMemoryFootprint.cu(199): error: identifier "graphExecs" is undefined

graphMemoryFootprint.cu(199): error: too many initializer values

graphMemoryFootprint.cu(200): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(200): error: declaration is incompatible with "int printf(const char *, ...)" /usr/include/crt/common_functions.h(153): here

graphMemoryFootprint.cu(200): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

graphMemoryFootprint.cu(201): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(201): error: declaration is incompatible with "void printMemoryFootprint(int)" (39): here

graphMemoryFootprint.cu(201): error: identifier "device" is undefined

graphMemoryFootprint.cu(203): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(203): error: variable "check" has already been defined

graphMemoryFootprint.cu(203): error: too many initializer values

graphMemoryFootprint.cu(204): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(204): error: variable "printf" has already been defined

graphMemoryFootprint.cu(205): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

graphMemoryFootprint.cu(207): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(207): error: variable "printf" has already been defined

graphMemoryFootprint.cu(207): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

graphMemoryFootprint.cu(208): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(208): error: variable "printMemoryFootprint" has already been defined

graphMemoryFootprint.cu(210): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(210): error: variable "printf" has already been defined

graphMemoryFootprint.cu(211): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

graphMemoryFootprint.cu(213): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(213): error: variable "printf" has already been defined

graphMemoryFootprint.cu(213): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

graphMemoryFootprint.cu(214): error: expected a declaration

graphMemoryFootprint.cu(220): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(222): error: expected a declaration

graphMemoryFootprint.cu(240): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(241): error: expected a declaration

graphMemoryFootprint.cu(271): warning: parsing restarts here after previous syntax error

graphMemoryFootprint.cu(272): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(272): error: variable "printMemoryFootprint" has already been defined

graphMemoryFootprint.cu(274): error: this declaration has no storage class or type specifier

graphMemoryFootprint.cu(274): error: variable "printf" has already been defined

graphMemoryFootprint.cu(275): error: a value of type "const char *" cannot be used to initialize an entity of type "int"

Error limit reached. 100 errors detected in the compilation of "graphMemoryFootprint.cu". Compilation terminated. make[1]: *** [Makefile:330: graphMemoryFootprint.o] Errore 1 make[1]: uscita dalla directory «/home/marietto/Scrivania/CUDA/cuda-samples/Samples/3_CUDA_Features/graphMemoryFootprint» make: *** [Makefile:45: Samples/3_CUDA_Features/graphMemoryFootprint/Makefile.ph_build] Errore 2

You should follow the steps in the Installation Guide recommended above. Installation Guide Linux :: CUDA Toolkit Documentation