coz
coz copied to clipboard
Compilation error on CentOS
Hello
I am trying to install coz on CentOS and have tried to closely follow all the installation instructions. However, I am getting following errors:
[coz/libcoz] Compiling inspect.cpp [coz/libcoz] Compiling profiler.cpp [coz/libcoz] Compiling libcoz.cpp [coz/libcoz] Compiling perf.cpp inspect.cpp:29:10: fatal error: libelfin/dwarf/dwarf++.hh: No such file or directory #include <libelfin/dwarf/dwarf++.hh> ^~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [../common.mk:70: obj/inspect.o] Error 1 make[1]: *** Waiting for unfinished jobs.... In file included from perf.h:18, from perf.cpp:8: perf.cpp: In member function ‘void perf_event::set_ready_signal(int)’: perf.cpp:182:32: error: ‘gettid’ was not declared in this scope REQUIRE(fcntl(_fd, F_SETOWN, gettid()) != -1) ^~~~~~ ccutil/log.h:80:24: note: in definition of macro ‘REQUIRE’ #define REQUIRE(cond) (cond) ? ccutil::logger_base() : FATAL ^~~~ perf.cpp:182:32: note: suggested alternative: ‘getgid’ REQUIRE(fcntl(_fd, F_SETOWN, gettid()) != -1) ^~~~~~ ccutil/log.h:80:24: note: in definition of macro ‘REQUIRE’ #define REQUIRE(cond) (cond) ? ccutil::logger_base() : FATAL ^~~~ make[1]: *** [../common.mk:70: obj/perf.o] Error 1 In file included from thread_state.h:13, from profiler.h:22, from libcoz.cpp:19: ccutil/timer.h: In constructor ‘timer::timer(int)’: ccutil/timer.h:19:25: error: ‘gettid’ was not declared in this scope ev._sigev_un._tid = gettid(); ^~~~~~ ccutil/timer.h:19:25: note: suggested alternative: ‘getgid’ ev._sigev_un._tid = gettid(); ^~~~~~ getgid In file included from thread_state.h:13, from profiler.h:22, from profiler.cpp:8: ccutil/timer.h: In constructor ‘timer::timer(int)’: ccutil/timer.h:19:25: error: ‘gettid’ was not declared in this scope ev._sigev_un._tid = gettid(); ^~~~~~ ccutil/timer.h:19:25: note: suggested alternative: ‘getgid’ ev._sigev_un._tid = gettid(); ^~~~~~ getgid profiler.cpp: In member function ‘thread_state* profiler::add_thread()’: profiler.cpp:303:32: error: ‘gettid’ was not declared in this scope return _thread_states.insert(gettid()); ^~~~~~ profiler.cpp:303:32: note: suggested alternative: ‘getgid’ return _thread_states.insert(gettid()); ^~~~~~ getgid profiler.cpp: In member function ‘thread_state* profiler::get_thread_state()’: profiler.cpp:307:30: error: ‘gettid’ was not declared in this scope return _thread_states.find(gettid()); ^~~~~~ profiler.cpp:307:30: note: suggested alternative: ‘getgid’ return _thread_states.find(gettid()); ^~~~~~ getgid profiler.cpp: In member function ‘void profiler::remove_thread()’: profiler.cpp:311:25: error: ‘gettid’ was not declared in this scope _thread_states.remove(gettid()); ^~~~~~ profiler.cpp:311:25: note: suggested alternative: ‘getgid’ _thread_states.remove(gettid()); ^~~~~~ getgid make[1]: *** [../common.mk:70: obj/libcoz.o] Error 1 make[1]: *** [../common.mk:70: obj/profiler.o] Error 1 make: *** [common.mk:97: all] Error 1
I have installed the libelfin as per the directions and have set the PKG_CONFIG_PATH. Can you please let me know what steps I am missing?
gettid
errors are likely #154
As for not finding your headers, try setting CPLUS_INCLUDE_PATH to the root of your libelfin's include dir, it sounds like you installed it to a non-standard location.
Agreed on the diagnosis. How old is this version of CentOS? (I just am wondering whether this is really worth supporting at this point.)
I get these errors on CentOS Linux release 7.7.1908 (Core)
According to Wikipedia, full updates for version 7 have already ended (though maintenance releases continue). Can you test on the latest release? (Version 8)
I can't but I'm sure it would work; Cent8 has a much more modern toolchain. From my understanding, CentOS is more common in enterprise than consumer/regular user land, so it's really up to you how you weigh supporting it. We were able to work around this issue by manually reverting #154.
I was having this issue when attempting to build on CentOS 7.9.2009. My solution was simply to clone the libelfin
project inside of the /libcoz
folder and build it there; the file structure looking something like this: coz/libcoz/libelfin/dwarf/...
.
I had a lot of weird issues on CentOS 7 that I had to correct (like LD_LIBRARY_PATH
not pointing to /usr/lib
), but I was able to build everything successfully.