Project

General

Profile

Actions

Bug #10999

closed

fail to compile with gcc 4.9.2

Added by Kefu Chai about 9 years ago. Updated about 9 years ago.

Status:
Won't Fix
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

[  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

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

[ 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;
                   ^

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

#include <utime.h>

failed to include the utime.h from libc.

Actions #1

Updated by Kefu Chai about 9 years ago

  • Description updated (diff)
Actions #2

Updated by Kefu Chai about 9 years ago

  • Status changed from 12 to Won't Fix

if i do an out-of-source build, the problem goes away.

cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/.local -DCMAKE_BUILD_TYPE=Debug  -B . ..

Actions

Also available in: Atom PDF