Syllo / nvtop

GPU & Accelerator process monitoring for AMD, Apple, Huawei, Intel, NVIDIA and Qualcomm
Other
8.1k stars 293 forks source link

error in "make": undefined reference to `clock_gettime' #115

Closed callzhang closed 3 years ago

callzhang commented 3 years ago

I am on Ubuntu 18.4. According to the instruction I was trying to compile from the source. On the step of make, I encountered the following error:

~/user/tools/nvtop/build$ make
[  7%] Linking C executable nvtop
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/nvtop.dir/nvtop.c.o: in function `main':
nvtop.c:(.text.startup.main+0x5ca): undefined reference to `clock_gettime'
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: nvtop.c:(.text.startup.main+0x5e4): undefined reference to `clock_gettime'
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/nvtop.dir/interface.c.o: in function `draw_devices':
interface.c:(.text.draw_devices+0xe4): undefined reference to `clock_gettime'
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/nvtop.dir/interface.c.o: in function `initialize_curses':
interface.c:(.text.initialize_curses+0xe4): undefined reference to `clock_gettime'
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/nvtop.dir/get_process_info_linux.c.o: in function `get_process_info':
get_process_info_linux.c:(.text.get_process_info+0x82): undefined reference to `clock_gettime'
/home/stardust/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/nvtop.dir/time.c.o:time.c:(.text.nvtop_get_current_time+0xa): more undefined references to `clock_gettime' follow
collect2: error: ld returned 1 exit status
src/CMakeFiles/nvtop.dir/build.make:383: recipe for target 'src/nvtop' failed
make[2]: *** [src/nvtop] Error 1
CMakeFiles/Makefile2:117: recipe for target 'src/CMakeFiles/nvtop.dir/all' failed
make[1]: *** [src/CMakeFiles/nvtop.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Any idea how to fix it?


Other info: ldd (Ubuntu GLIBC 2.27-3ubuntu1.4) 2.27 gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

callzhang commented 3 years ago

solved by reinstalling g++