← All tasks
cppapache/brpc #3203Not a task: not reproduced

Ubuntu 22.04 编译报错,修改CMakeLists后成功

envgap__apache__brpc-3203

01 / FAILURE SIGNATURE

As reported upstream

/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:29:44: error: expected class-name before '{' token
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
02879c89d962f1b6363979437515131b4457ffb8
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

apache/brpc #3203 · read the original issue
**Describe the bug**

[95/336] Building CXX object src/CMakeFiles/SOURCES_LIB.dir/brpc/builtin/vlog_service.cpp.o
FAILED: src/CMakeFiles/SOURCES_LIB.dir/brpc/builtin/vlog_service.cpp.o  -I/home/buildarea/brpc-1.14.1-src/src -I. -I/home/include -Isrc -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -msse4 -msse4.2 -Wno-aligned-new -DNDEBUG -std=gnu++11 -MD -MT src/CMakeFiles/SOURCES_LIB.dir/brpc/builtin/vlog_service.cpp.o -MF src/CMakeFiles/SOURCES_LIB.dir/brpc/builtin/vlog_service.cpp.o.d -o src/CMakeFiles/SOURCES_LIB.dir/brpc/builtin/vlog_service.cpp.o -c /home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:29:44: error: expected class-name before '{' token
   29 | class VLogPrinter : public VLogSitePrinter {
      |                                            ^
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:34:22: error: 'VLogSitePrinter' does not name a type; did you mean 'VLogPrinter'?
   34 |     void print(const VLogSitePrinter::Site& site) {
      |                      ^~~~~~~~~~~~~~~
      |                      VLogPrinter
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:34:43: error: expected unqualified-id before '&' token
   34 |     void print(const VLogSitePrinter::Site& site) {
      |                                           ^
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:34:43: error: expected ')' before '&' token
   34 |     void print(const VLogSitePrinter::Site& site) {
      |               ~                           ^
      |                                           )
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:34:43: error: expected ';' at end of member declaration
   34 |     void print(const VLogSitePrinter::Site& site) {
      |                                           ^
      |                                            ;
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:34:45: error: 'site' does not name a type
   34 |     void print(const VLogSitePrinter::Site& site) {
      |                                             ^~~~
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:64:6: error: 'VLogService' has not been declared
   64 | void VLogService::default_method(::google::protobuf::RpcController* cntl_base,
      |      ^~~~~~~~~~~
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:65:48: error: 'VLogRequest' in namespace 'brpc' does not name a type
   65 |                                  const ::brpc::VLogRequest*,
      |                                                ^~~~~~~~~~~
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:66:42: error: 'brpc::VLogResponse' has not been declared
   66 |                                  ::brpc::VLogResponse*,
      |                                          ^~~~~~~~~~~~
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp: In function 'void brpc::default_method(google::protobuf::RpcController*, const int*, int*, google::protobuf::Closure*)':
/home/buildarea/brpc-1.14.1-src/src/brpc/builtin/vlog_service.cpp:85:5: error: 'print_vlog_sites' was not declared in this scope
   85 |     print_vlog_sites(&printer);
      |     ^~~~~~~~~~~~~~~~

**To Reproduce**
编译选项 -DWITH_SNAPPY=ON -DWITH_GLOG=ON

**Expected behavior**
编译通过

**Versions**
OS: Ubuntu 22.04
Compiler: 
brpc: 1.14.1 1.16.0
protobuf: 1.16.0

**Additional context/screenshots**
发现CMakeLists中149行 set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer")改为
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CXX_FLAGS } -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer")
就可以编译成功,感觉这一行是个bug
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]