pika icon indicating copy to clipboard operation
pika copied to clipboard

compile error with gcc 11.3

Open sp3c73r2038 opened this issue 3 years ago • 4 comments

build with gcc 11.3.0 against tag v3.4.1 as well as master branch. got this error.

g++ (Gentoo Hardened 11.3.0 p4) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
db/db_impl_compaction_flush.cc:696:21: error: loop variable ‘newf’ creates a copy from type ‘const std::pair<int, rocksdb::FileMetaData>’ [-Werror=range-loop-construct]
  696 |     for (const auto newf : c->edit()->GetNewFiles()) {
      |                     ^~~~

not very familiar with cpp though.

sp3c73r2038 avatar Jun 06 '22 02:06 sp3c73r2038

this is because the gcc version is too high so that rocksdb version doesn't compate. The simplest way to solve this is that using gcc at most 9.1。

kernelai avatar Jun 06 '22 06:06 kernelai

good to know. I will try to build it with an older version of gcc then.

it will be nice if mention gcc version requirements in README (it only requires 4.8+ now).

sp3c73r2038 avatar Jun 06 '22 08:06 sp3c73r2038

update:

I see you are using -Wno-error=deprecated-copy -Wno-error=pessimizing-move in v3.4.1 and master. these options for gcc are added in gcc9. so better mention this in README (which says 4.8) i suppose.

after I setup another box with gcc 9.5, along with glog 0.5.0 and protobuf 3.19.3.

also, when I go for another build, I got

/tmp/pika/src/pika_repl_client_conn.cc: In member function ‘virtual int PikaReplClientConn::DealMessage()’:
/tmp/pika/src/pika_repl_client_conn.cc:50:98: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int, int)’
   50 |   decoder.SetTotalBytesLimit(g_pika_conf->max_conn_rbuf_size(), g_pika_conf->max_conn_rbuf_size());
      |                                                                                                  ^
In file included from /usr/include/google/protobuf/message_lite.h:47,
                 from /usr/include/google/protobuf/generated_enum_util.h:36,
                 from /usr/include/google/protobuf/generated_enum_reflection.h:44,
                 from /usr/include/google/protobuf/generated_message_reflection.h:46,
                 from /usr/include/google/protobuf/message.h:122,
                 from /tmp/pika/third/pink/pink/include/pb_conn.h:13,
                 from ./include/pika_repl_client_conn.h:9,
                 from /tmp/pika/src/pika_repl_client_conn.cc:6:

After some dig, it's caused by protobuf version. They added a single parameter version in 3.8 and removed deprecated version since 3.18.

after I downgrade protobuf to 3.17.3, it builds all well without problems.

It looks like the library pika master currently depends on are quite old, so maybe better to check those libraries version more strictly in Makefile or so.

sp3c73r2038 avatar Jun 16 '22 08:06 sp3c73r2038

update:

I see you are using -Wno-error=deprecated-copy -Wno-error=pessimizing-move in v3.4.1 and master. these options for gcc are added in gcc9. so better mention this in README (which says 4.8) i suppose.

after I setup another box with gcc 9.5, along with glog 0.5.0 and protobuf 3.19.3.

also, when I go for another build, I got

/tmp/pika/src/pika_repl_client_conn.cc: In member function ‘virtual int PikaReplClientConn::DealMessage()’:
/tmp/pika/src/pika_repl_client_conn.cc:50:98: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int, int)’
   50 |   decoder.SetTotalBytesLimit(g_pika_conf->max_conn_rbuf_size(), g_pika_conf->max_conn_rbuf_size());
      |                                                                                                  ^
In file included from /usr/include/google/protobuf/message_lite.h:47,
                 from /usr/include/google/protobuf/generated_enum_util.h:36,
                 from /usr/include/google/protobuf/generated_enum_reflection.h:44,
                 from /usr/include/google/protobuf/generated_message_reflection.h:46,
                 from /usr/include/google/protobuf/message.h:122,
                 from /tmp/pika/third/pink/pink/include/pb_conn.h:13,
                 from ./include/pika_repl_client_conn.h:9,
                 from /tmp/pika/src/pika_repl_client_conn.cc:6:

After some dig, it's caused by protobuf version. They added a single parameter version in 3.8 and removed deprecated version since 3.18.

after I downgrade protobuf to 3.17.3, it builds all well without problems.

It looks like the library pika master currently depends on are quite old, so maybe better to check those libraries version more strictly in Makefile or so.

we know that. rocksdb and pb are too old. maybe fix in this year, current have no times to do that.

wanghenshui avatar Aug 02 '22 08:08 wanghenshui

fixed now

wanghenshui avatar Feb 18 '23 13:02 wanghenshui