21 Commits

Author SHA1 Message Date
Robin Voetter
1495790f47 cmake: use check_linker_flag for checking linker flags
check_c_compiler_flag does not actually pass the flag to the linker, and
so the test file successfully compiles for any linker flag. This
caused the -Wl,z,relro flag to be passed to the compiler even if it was
not supported.

check_c_compiler_flag was introduced in cmake 3.18, so this commit also
bumps the minimum required cmake version to 3.18 (released in 2020).
2023-08-12 14:07:22 +02:00
Maxime Schmitt
cfb078edf4 Fix FindUDev and FindSystemd for older cmake 2022-10-15 15:26:27 +02:00
Maxime Schmitt
8cd2ee0892 Udev/sd-device wrapper 2022-10-09 18:40:25 +02:00
Maxime Schmitt
1ad82b6ab1 Preliminary Intel support 2022-10-08 13:57:32 +02:00
Maxime Schmitt
5997553697 Enable format warnings 2022-08-26 23:10:05 +02:00
Maxime Schmitt
b4165e6186 Disable over-verbose warnings and enable useful ones 2022-04-04 19:59:30 +02:00
Maxime Schmitt
0b9ad27dc2 Dev tooling improvement 2022-04-04 19:59:30 +02:00
Maxime Schmitt
131cb81845 Use libdrm for AMDGPU support 2022-04-04 19:59:30 +02:00
YiFei Zhu
e8185d3c29 optimization_flags.cmake: Disable quite a few warnings
Some of them are very useless. If we really want we can fix them
later, but -Wall already contains most of the useful warnings.
2022-04-04 19:59:30 +02:00
Maxime Schmitt
8b6519eebc Build system update following the gpuinfo redesign 2021-05-11 22:09:27 +02:00
Zeming Lin
84902667d4 More paths for NVML library 2021-05-03 19:28:46 +02:00
Zeming Lin
4e981a749d Add additional path hints for nvml 2021-01-12 14:21:14 +01:00
Maxime Schmitt
5fb0ab5c3c CMake: add nvml path hints 2020-08-22 14:12:47 +01:00
Huang Rui
e9767ccc89 Fix crash bug when build with -DCURSES_NEED_WIDE=TRUE
Fix crash bug when build with libncursesw.so.6 and libtinfow.so.6

The FindCurses.cmake is too old to build with
```-DCURSES_NEED_WIDE=TRUE``` option.
In some latest ENV, always using libncursesw.so.6 and libtinfow.so.6.
The nvtop will crashed with these messages below:

```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==50432==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000c8 (pc 0x7f9c4d507d39 bp 0x7f9c4d4e6de8 sp 0x7ffc057963a8 T0)
==50432==The signal is caused by a READ memory access.
==50432==Hint: address points to the zero page.
    #0 0x7f9c4d507d38 in termattrs_sp (/lib64/libncursesw.so.6+0x1fd38)
    #1 0x7f9c4d504f73 in _nc_setupscreen_sp (/lib64/libncursesw.so.6+0x1cf73)
    #2 0x7f9c4d50078b in newterm_sp (/lib64/libncursesw.so.6+0x1878b)
    #3 0x7f9c4d500c08 in newterm (/lib64/libncursesw.so.6+0x18c08)
    #4 0x7f9c4d4fca53 in initscr (/lib64/libncursesw.so.6+0x14a53)
    #5 0x55bd7f6d693d in initialize_curses (/usr/local/bin/nvtop+0x5893d)
    #6 0x55bd7f6c9f7a in main (/usr/local/bin/nvtop+0x4bf7a)
    #7 0x7f9c4c998f1a in __libc_start_main (/lib64/libc.so.6+0x23f1a)
    #8 0x55bd7f6ca789 in _start (/usr/local/bin/nvtop+0x4c789)
```

The load library have some problem, NOTE libtinfow.so.6 and
libtinfo.so.6 load at the same time, it is the root cause.

```
ldd /usr/local/bin/nvtop
	linux-vdso.so.1 (0x00007ffca6d82000)
	libasan.so.5 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libasan.so.5 (0x00007f8823464000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f8823326000)
	libnvidia-ml.so.1 => /usr/lib64/libnvidia-ml.so.1 (0x00007f8822d00000)
	libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007f8822cc5000)
	libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f8822c89000)
	libubsan.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libubsan.so.1 (0x00007f8822321000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f8822152000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f882214c000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f8822142000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8822120000)
	libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libstdc++.so.6 (0x00007f8821ea8000)
	libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/libgcc_s.so.1 (0x00007f8821e8e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8823fc5000)
	libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007f8821e4f000)
```

To fix it, the FindCurses.cmake should using libtinfow.so.6 instead of
libtinfo.so.6 when DCURSES_NEED_WIDE=TRUE. So I updated the
FindCurses.cmake to latest version to fix this problem.

Signed-off-by: Huang Rui <vowstar@gmail.com>
2019-10-25 04:23:33 +08:00
Maxime Schmitt
89f023c952 Add recent FindCurses cmake module for ncursesw support 2018-11-21 13:46:39 +01:00
Maxime Schmitt
a142d1d7ec CMake: compilation flag helper 2018-11-21 13:46:39 +01:00
Maxime Schmitt
4785fe8435 CMake Update 2018-11-21 13:46:39 +01:00
Maxime Schmitt
b7d626a8bc nvml header search location 2018-08-19 15:25:09 +02:00
Maxime Schmitt
cea46dea95 Architecture aware regex search for nvml library 2018-04-07 23:49:15 +02:00
Maxime Schmitt
0c6cf94e2b Update CMake search path for NVML lib and include 2018-04-06 14:23:48 +02:00
Maxime Schmitt
d9f62ba17d Initial commit 2017-06-16 11:50:53 +02:00