Project

General

Profile

Bug #10999

Updated by Kefu Chai about 9 years ago

<pre> 
 [    4%] Building C object src/CMakeFiles/common.dir/crush/builder.c.o 
 In file included from /home/kefu/dev/ceph/src/crush/builder.c:6:0: 
 /home/kefu/dev/ceph/src/include/assert.h:15:1: error: unknown type name ‘class’ 
  class CephContext; 
  ^ 
 /home/kefu/dev/ceph/src/include/assert.h:68:37: error: expected declaration specifiers or ‘...’ before ‘CephContext’ 
  extern void register_assert_context(CephContext *cct); 
                                      ^ 
 src/CMakeFiles/common.dir/build.make:354: recipe for target 'src/CMakeFiles/common.dir/crush/builder.c.o' failed 
 make[2]: *** [src/CMakeFiles/common.dir/crush/builder.c.o] Error 1 
 CMakeFiles/Makefile2:636: recipe for target 'src/CMakeFiles/common.dir/all' failed 
 make[1]: *** [src/CMakeFiles/common.dir/all] Error 2 
 Makefile:117: recipe for target 'all' failed 
 make: *** [all] Error 2 
 </pre> 

 @assert.h@ is a header file which should also work with C compiler as well as C++, so might want to declare CephContext as a *struct* but not *class*. 


 and 

 <pre> 
 [ 27%] Building CXX object src/CMakeFiles/client.dir/client/Client.cc.o 
 cd /home/kefu/dev/ceph/src && /usr/bin/c++     -DCEPH_LIBDIR=\"/home/kefu/.local/lib\" -DCEPH_PKGLIBDIR=\"/home/kefu/.local/lib\" -D__linux__ -rdynamic -Wall -Wtype-limits -Wignored-qualifier 
 s -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -fPIC -ftemplate-depth-1024 -Wno-invalid-offsetof -Wnon-virtual-dtor -Wno-invalid-offsetof -Wstrict- 
 null-sentinel -Woverloaded-virtual -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -g -I/home/kefu/dev/ceph/src/include -I/include -I/home/kefu/dev/ceph/src - 
 I/home/kefu/dev/ceph/include -I/home/kefu/dev/ceph/src/civetweb/include      -DHAVE_CONFIG_H -D__CEPH__ -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -D_GNU_SOURCE 
  -o CMakeFiles/client.dir/client/Client.cc.o -c /home/kefu/dev/ceph/src/client/Client.cc 
 /home/kefu/dev/ceph/src/client/Client.cc: In member function ‘int Client::utime(const char*, utimbuf*)’: 
 /home/kefu/dev/ceph/src/client/Client.cc:5716:19: error: invalid use of incomplete type ‘struct utimbuf’ 
    tout(cct) << buf->modtime << std::endl; 
                    ^ 
 In file included from /home/kefu/dev/ceph/src/client/Client.cc:80:0: 
 /home/kefu/dev/ceph/src/client/Client.h:815:38: error: forward declaration of ‘struct utimbuf’ 
    int utime(const char *path, struct utimbuf *buf); 
                                       ^ 
 /home/kefu/dev/ceph/src/client/Client.cc:5717:19: error: invalid use of incomplete type ‘struct utimbuf’ 
    tout(cct) << buf->actime << std::endl; 
                    ^ 
 </pre> 

 the root cause is that the @$top_src/src/include/utime.h@ get picked up by the compiler first. so 

 <pre> 
 #include <utime.h> 
 </pre> 

 failed to include the @utime.h@ from libc.

Back