rib / gputop

A GPU profiling tool
160 stars 37 forks source link

gputop fails to build on Cent OS 7.3 #162

Closed dvrogozh closed 7 years ago

dvrogozh commented 7 years ago

gputop fails to build on Cent OS 7.3 with at least the following errors:

../protoc-c/c_helpers.h:80:12: error: ‘std::set’ has not been declared
 using std::set;
            ^
c_bytes_field.cc: In member function ‘virtual void google::protobuf::compiler::c::BytesFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const’:
c_bytes_field.cc:104:24: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
       if (descriptor_->containing_oneof() == NULL)

gputop-gl.c:37:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"

The first issue is trivial miss of #include <set>. The second issue looks coming from incompatible version of protobuf included into Cent OS 7.3 distribution:

$ yum install protobuf-devel
$ cat /usr/lib64/pkgconfig/protobuf.pc  | grep Version
Version: 2.5.0

Mind that right now gputop configure.ac does not have minimal version specification for protobuf:

$ cat configure.ac | grep protobuf
PKG_CHECK_MODULES(PROTOBUF_DEP, [protobuf])

Finally, the third issue (no stdatomic.h) looks related to the gcc version used on Cent OS 7.3 which is 4.8.5 - see here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016 (stdatomic.h is missing, fixed in gcc 4.9).

djdeath commented 7 years ago

Could you paste the error you're seeing related to the incompatible version of protobuf?

dvrogozh commented 7 years ago

Already posted in the description: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’

But if you want all errors I see right now, here is the log after 'make -i' (mind that there could be some other issues non-related with protobuf - I did not look too closely):

make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/protoc-c'
  CXX      c_bytes_field.o
c_bytes_field.cc: In member function ‘virtual void google::protobuf::compiler::c::BytesFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const’:
c_bytes_field.cc:104:24: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
       if (descriptor_->containing_oneof() == NULL)
                        ^
make[2]: [c_bytes_field.o] Error 1 (ignored)
  CXX      c_enum_field.o
c_enum_field.cc: In member function ‘virtual void google::protobuf::compiler::c::EnumFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const’:
c_enum_field.cc:109:24: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
       if (descriptor_->containing_oneof() == NULL)
                        ^
make[2]: [c_enum_field.o] Error 1 (ignored)
  CXX      c_field.o
c_field.cc: In member function ‘void google::protobuf::compiler::c::FieldGenerator::GenerateDescriptorInitializerGeneric(google::protobuf::io::Printer*, bool, const string&, const string&) const’:
c_field.cc:117:9: error: ‘OneofDescriptor’ does not name a type
   const OneofDescriptor *oneof = descriptor_->containing_oneof();
         ^
c_field.cc:118:7: error: ‘oneof’ was not declared in this scope
   if (oneof != NULL)
       ^
c_field.cc:139:7: error: ‘oneof’ was not declared in this scope
   if (oneof != NULL)
       ^
c_field.cc:153:11: error: ‘oneof’ was not declared in this scope
       if (oneof != NULL) {
           ^
make[2]: [c_field.o] Error 1 (ignored)
  CXX      c_message.o
c_message.cc: In member function ‘void google::protobuf::compiler::c::MessageGenerator::GenerateStructDefinition(google::protobuf::io::Printer*)’:
c_message.cc:151:36: error: ‘const class google::protobuf::Descriptor’ has no member named ‘oneof_decl_count’
   for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
                                    ^
c_message.cc:152:11: error: ‘OneofDescriptor’ does not name a type
     const OneofDescriptor *oneof = descriptor_->oneof_decl(i);
           ^
c_message.cc:153:41: error: ‘oneof’ was not declared in this scope
     vars["oneofname"] = FullNameToUpper(oneof->name());
                                         ^
c_message.cc:182:16: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
     if (field->containing_oneof() == NULL) {
                ^
c_message.cc:193:36: error: ‘const class google::protobuf::Descriptor’ has no member named ‘oneof_decl_count’
   for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
                                    ^
c_message.cc:194:11: error: ‘OneofDescriptor’ does not name a type
     const OneofDescriptor *oneof = descriptor_->oneof_decl(i);
           ^
c_message.cc:195:41: error: ‘oneof’ was not declared in this scope
     vars["oneofname"] = FullNameToLower(oneof->name());
                                         ^
c_message.cc:229:16: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
     if (field->containing_oneof() == NULL) {
                ^
c_message.cc:234:36: error: ‘const class google::protobuf::Descriptor’ has no member named ‘oneof_decl_count’
   for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
                                    ^
c_message.cc:235:11: error: ‘OneofDescriptor’ does not name a type
     const OneofDescriptor *oneof = descriptor_->oneof_decl(i);
           ^
c_message.cc:236:42: error: ‘oneof’ was not declared in this scope
     vars["foneofname"] = FullNameToUpper(oneof->full_name());
                                          ^
make[2]: [c_message.o] Error 1 (ignored)
  CXX      c_primitive_field.o
c_primitive_field.cc: In member function ‘virtual void google::protobuf::compiler::c::PrimitiveFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const’:
c_primitive_field.cc:116:24: error: ‘const class google::protobuf::FieldDescriptor’ has no member named ‘containing_oneof’
       if (descriptor_->containing_oneof() == NULL)
                        ^
make[2]: [c_primitive_field.o] Error 1 (ignored)
  CXXLD    protoc-c
g++: error: c_bytes_field.o: No such file or directory
g++: error: c_enum_field.o: No such file or directory
g++: error: c_field.o: No such file or directory
g++: error: c_message.o: No such file or directory
g++: error: c_primitive_field.o: No such file or directory
make[2]: [protoc-c] Error 1 (ignored)
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/protoc-c'
Making all in h2o
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/h2o'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/h2o'
Making all in gputop-data
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-data'
make  all-am
make[3]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-data'
make -f ./Makefile.xml  top_srcdir=.. builddir=. all
make[4]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-data'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/data/dvrogozh/git/otc/gputop/gputop-data'
make[3]: Leaving directory `/data/dvrogozh/git/otc/gputop/gputop-data'
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/gputop-data'
Making all in gputop-server
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-server'
../protoc-c/protoc-c --c_out=../gputop-server -I../gputop-data ../gputop-data/gputop.proto
make[2]: ../protoc-c/protoc-c: Command not found
make[2]: [gputop.pb-c.h] Error 127 (ignored)
make  all-recursive
make[3]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-server'
Making all in registry
make[4]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-server/registry'
make  all-am
make[5]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-server/registry'
make[5]: Nothing to be done for `all-am'.
make[5]: Leaving directory `/data/dvrogozh/git/otc/gputop/gputop-server/registry'
make[4]: Leaving directory `/data/dvrogozh/git/otc/gputop/gputop-server/registry'
make[4]: Entering directory `/data/dvrogozh/git/otc/gputop/gputop-server'
  CC       libgputop_la-gputop-perf.lo
In file included from gputop-perf.c:57:0:
gputop-log.h:34:25: fatal error: gputop.pb-c.h: No such file or directory
 #include "gputop.pb-c.h"
                         ^
compilation terminated.
make[4]: [libgputop_la-gputop-perf.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-perf.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-perf.lo] Error 1 (ignored)
  CC       libgputop_la-gputop-log.lo
In file included from gputop-log.c:32:0:
gputop-log.h:34:25: fatal error: gputop.pb-c.h: No such file or directory
 #include "gputop.pb-c.h"
                         ^
compilation terminated.
make[4]: [libgputop_la-gputop-log.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-log.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-log.lo] Error 1 (ignored)
  CC       libgputop_la-gputop-ncurses.lo
gputop-ncurses.c:38:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"
                       ^
compilation terminated.
make[4]: [libgputop_la-gputop-ncurses.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-ncurses.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-ncurses.lo] Error 1 (ignored)
  CC       libgputop_la-gputop-cpu.lo
In file included from gputop-cpu.c:35:0:
gputop-log.h:34:25: fatal error: gputop.pb-c.h: No such file or directory
 #include "gputop.pb-c.h"
                         ^
compilation terminated.
make[4]: [libgputop_la-gputop-cpu.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-cpu.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-cpu.lo] Error 1 (ignored)
../protoc-c/protoc-c --c_out=../gputop-server -I../gputop-data ../gputop-data/gputop.proto
make[4]: ../protoc-c/protoc-c: Command not found
make[4]: [gputop.pb-c.c] Error 127 (ignored)
  CC       libgputop_la-gputop.pb-c.lo
gcc: error: ./gputop.pb-c.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
make[4]: [libgputop_la-gputop.pb-c.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop.pb-c.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop.pb-c.lo] Error 1 (ignored)
  CC       libgputop_la-gputop-server.lo
In file included from ../h2o/include/h2o.h:40:0,
                 from gputop-server.c:42:
../h2o/include/h2o/hostinfo.h: In function 'h2o_hostinfo_select_one':
../h2o/include/h2o/hostinfo.h:78:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t i = 0;
     ^
In file included from gputop-server.c:42:0:
../h2o/include/h2o.h: In function 'h2o_doublebuffer_prepare':
../h2o/include/h2o.h:2061:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         h2o_buffer_t *t = db->buf;
         ^
In file included from gputop-server.c:51:0:
gputop-log.h: At top level:
gputop-log.h:34:25: fatal error: gputop.pb-c.h: No such file or directory
 #include "gputop.pb-c.h"
                         ^
compilation terminated.
make[4]: [libgputop_la-gputop-server.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-server.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-server.lo] Error 1 (ignored)
  CC       libgputop_la-gputop-gl.lo
gputop-gl.c:37:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"
                       ^
compilation terminated.
make[4]: [libgputop_la-gputop-gl.lo] Error 1 (ignored)
mv: cannot stat ‘.deps/libgputop_la-gputop-gl.Tpo’: No such file or directory
make[4]: [libgputop_la-gputop-gl.lo] Error 1 (ignored)
  CCLD     libgputop.la
libtool: link: `libgputop_la-gputop-perf.lo' is not a valid libtool object
make[4]: [libgputop.la] Error 1 (ignored)
  CCLD     libfakeGL.la
libtool: link: cannot find the library `libgputop.la' or unhandled argument `libgputop.la'
make[4]: [libfakeGL.la] Error 1 (ignored)
  CCLD     gputop-system
libtool: link: cannot find the library `libgputop.la' or unhandled argument `libgputop.la'
make[4]: [gputop-system] Error 1 (ignored)
djdeath commented 7 years ago

I'm working on importing protobuf into gputop. I think it makes sense, because we want the server to have a little dependencies as possible (in particular if we want it to work on android).

dvrogozh commented 7 years ago

Hm. This sounds promising. I actually thought that you won't fix this issue for CentOS and just limit minimal required version of protobuf, but if you import it, then you should be able to resolve it. Please, fill free to provide me a draft patch to verify.

dvrogozh commented 7 years ago

One more issue looks coming from Cent OS gcc 4.8.5 version which misses stdatomic.h: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016. It is said this was fixed in 4.9 only.

This include comes with the funny comment in gputop sources:

/* NB: We use a portable stdatomic.h, so we don't depend on a recent compiler...
 */
#include "stdatomic.h"

Aha... I noted:)...

Interesting... Actually you do have stdatomic.h in the sources, it is here: gputop-webui/stdatomic.h. But I am lazy enough to build gputop without webui support (I just invoked ./autogen.sh && make -i) and probably that's why I stepped into that. Do you have some dependency between gputop-server and gputop-webui which you don't realize? If both folders want to use same and your our stdatomic.h, you need to place it in some utils or common folder and I would rename it to avoid conflict with the system-wide header which will appear in gcc 4.9...

djdeath commented 7 years ago

Let me know if https://github.com/rib/gputop/tree/for-master works for you.

djdeath commented 7 years ago

Should be fixed on master.

dvrogozh commented 7 years ago

Hi, I somehow managed to miss your update and request to verify the fix. Will check now.

dvrogozh commented 7 years ago

All previous issues I have reported look fixed. But unfortunately we stepped into another issue in centos 7.3 gcc/g++ 4.8.5 compiler: is_trivially_copy_assignable not implemented:

$ fgrep -rsn is_trivially_copy_assignable /usr/include/
/usr/include/c++/4.8.2/type_traits:1198:  /// is_trivially_copy_assignable (still unimplemented)

Here is a full log I got now:

$ make -i
make  all-recursive
make[1]: Entering directory `/data/dvrogozh/git/otc/gputop'
Making all in libuv
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/libuv'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/libuv'
Making all in protobuf
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/protobuf'
  CXX      google/protobuf/libprotobuf_la-generated_message_table_driven.lo
google/protobuf/generated_message_table_driven.cc: In function 'Type* google::protobuf::internal::{anonymous}::AddField(google::protobuf::MessageLite*, google::protobuf::int64)':
google/protobuf/generated_message_table_driven.cc:79:17: error: 'is_trivially_copy_assignable' is not a member of 'std'
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                 ^
google/protobuf/generated_message_table_driven.cc:79:55: error: expected primary-expression before '>' token
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                       ^
google/protobuf/generated_message_table_driven.cc:79:56: error: '::value' has not been declared
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                        ^
google/protobuf/generated_message_table_driven.cc: In function 'void google::protobuf::internal::{anonymous}::AddField(google::protobuf::MessageLite*, google::protobuf::int64, Type)':
google/protobuf/generated_message_table_driven.cc:99:17: error: 'is_trivially_copy_assignable' is not a member of 'std'
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                 ^
google/protobuf/generated_message_table_driven.cc:99:55: error: expected primary-expression before '>' token
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                       ^
google/protobuf/generated_message_table_driven.cc:99:56: error: '::value' has not been declared
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                        ^
google/protobuf/generated_message_table_driven.cc: In function 'void google::protobuf::internal::{anonymous}::SetField(google::protobuf::MessageLite*, google::protobuf::uint32*, google::protobuf::uint32, google::protobuf::int64, Type)':
google/protobuf/generated_message_table_driven.cc:123:17: error: 'is_trivially_copy_assignable' is not a member of 'std'
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                 ^
google/protobuf/generated_message_table_driven.cc:123:55: error: expected primary-expression before '>' token
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                       ^
google/protobuf/generated_message_table_driven.cc:123:56: error: '::value' has not been declared
   static_assert(std::is_trivially_copy_assignable<Type>::value,
                                                        ^
make[2]: [google/protobuf/libprotobuf_la-generated_message_table_driven.lo] Error 1 (ignored)
mv: cannot stat ‘google/protobuf/.deps/libprotobuf_la-generated_message_table_driven.Tpo’: No such file or directory
make[2]: [google/protobuf/libprotobuf_la-generated_message_table_driven.lo] Error 1 (ignored)
  CXXLD    libprotobuf.la
libtool: link: `google/protobuf/libprotobuf_la-generated_message_table_driven.lo' is not a valid libtool object
make[2]: [libprotobuf.la] Error 1 (ignored)
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/protobuf'
Making all in protobuf-c
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/protobuf-c'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/protobuf-c'
Making all in protoc-c
make[2]: Entering directory `/data/dvrogozh/git/otc/gputop/protoc-c'
make[2]: *** No rule to make target `../protobuf/libprotobuf.la', needed by `protoc-c'.  Stop.
make[2]: Leaving directory `/data/dvrogozh/git/otc/gputop/protoc-c'
make[1]: [all-recursive] Error 1 (ignored)
make[1]: Leaving directory `/data/dvrogozh/git/otc/gputop'
djdeath commented 7 years ago

Pushed another commit to disable those asserts. Hopefully that's it.

dvrogozh commented 7 years ago

Build still fails. We are back to the problem with stdatomic.h:

gputop-ncurses.c:38:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"
                       ^
gputop-gl.h: At top level:
gputop-gl.h:33:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"
                       ^
gputop-gl.c:37:23: fatal error: stdatomic.h: No such file or directory
 #include "stdatomic.h"
                       ^

I am building with make -i, but still may miss some errors...

djdeath commented 7 years ago

I just updated master with a travis configuration that test things on CentOS 7, just like we do on Ubuntu 16.04. This fixes the stdatomic.h problem.

dvrogozh commented 7 years ago

I finally was able to build it on centos 7.3, thank you. Will try out in a week after vacation.