nvtop icon indicating copy to clipboard operation
nvtop copied to clipboard

Missing <linux/kcmp.h> breaks build on CentOS 7

Open lgorenstein opened this issue 3 years ago • 2 comments

Hello, and thank you for the great tool!

Reporting a problem with building NVTOP on an HPC cluster here. CentOS 7.9, kernel 3.10.0-1160.62.1.el7.x86_64, CUDA 11.7. Cmake part goes fine, but the build dies near the end:

[ 92%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu.c.o
/home/lev/software/nvtop/2.0.2/nvtop/src/extract_gpuinfo_amdgpu.c:36:24: fatal error: linux/kcmp.h: No such file or directory
 #include <linux/kcmp.h>
                        ^
compilation terminated.
make[2]: *** [src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu.c.o] Error 1
make[1]: *** [src/CMakeFiles/nvtop.dir/all] Error 2

Builds fine on Rocky 8.4 and Ubuntu 18.04 with 4.* kernels, but not on older systems with kernel 3.*. Is there a way to avoid/bypass dependency on this header?

lgorenstein avatar Jun 12 '22 09:06 lgorenstein

According to the kcmp manual page (https://linux.die.net/man/2/kcmp), the syscall was introduced in the linux kernel 3.5.

In your case you might need to install the kernel headers for your kernel. The standard yum way: yum install kernel-devel

Syllo avatar Jun 14 '22 13:06 Syllo

If you don't have AMD GPUs you can also pass -DAMDGPU_SUPPORT=OFF to cmake

Syllo avatar Jun 14 '22 13:06 Syllo

Closing since the AMDGPU support can be disabled on old kernels (Linux 3.10 is from 2013). Support for AMDGPU would probably not work as expected on this version anyway.

Syllo avatar Sep 03 '22 08:09 Syllo

I'm afraid disabling AMDGPU support doesn't solve this issue (anymore?).

In nvtop 3.0.1, kernel 3.10.0-1160.88.1.el7.x86_64:

# cmake -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=OFF -DINTEL_SUPPORT=OFF  ..
[...]
# make
[...]
[ 53%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo.c.o
[ 60%] Building C object src/CMakeFiles/nvtop.dir/extract_processinfo_fdinfo.c.o
/dev/shm/nvtop-3.0.1/src/extract_processinfo_fdinfo.c:28:24: fatal error: linux/kcmp.h: No such file or directory
 #include <linux/kcmp.h>
                        ^
compilation terminated.

kcgthb avatar Mar 22 '23 21:03 kcgthb

https://github.com/Syllo/nvtop/issues/195#issuecomment-1590262915 worked for me.

Lacedaemon avatar Jun 14 '23 01:06 Lacedaemon

As long as defined constants stay constant :)

Thank you for the tip @Lacedaemon, I'll try this trick here.

lgorenstein avatar Jun 14 '23 01:06 lgorenstein

As long as defined constants stay constant :)

It won't. They are kernel UAPI, so as long as it's Linux it won't change.

zhuyifei1999 avatar Jun 15 '23 10:06 zhuyifei1999