Comment 5 for bug 1964260

Revision history for this message
In , Kevin Zhao (kevin-zhao) wrote :

Build rocksdb with GCC 9.4.0:
# git clone https://github.com/facebook/rocksdb.git
# cd rocksdb
# make static_lib

Log as below:
====================================================
$DEBUG_LEVEL is 0
  CC util/crc32c.o
util/crc32c.cc:371:1: error: template with C linkage
  371 | template<void (*CRC32)(uint64_t*, uint8_t const**)>
      | ^~~~~~~~
In file included from ./util/crc32c_arm64.h:16,
                 from util/crc32c.cc:21:
/usr/lib/gcc/aarch64-linux-gnu/9/include/arm_acle.h:33:1: note: ‘extern "C"’ linkage started here
   33 | extern "C" {
      | ^~~~~~~~~~
util/crc32c.cc:503:13: error: conflicting declaration of ‘std::string rocksdb::crc32c::IsFastCrc32Supported()’ with ‘C’ linkage
  503 | std::string IsFastCrc32Supported() {
      | ^~~~~~~~~~~~~~~~~~~~
In file included from util/crc32c.cc:12:
./util/crc32c.h:20:20: note: previous declaration with ‘C++’ linkage
   20 | extern std::string IsFastCrc32Supported();
      | ^~~~~~~~~~~~~~~~~~~~
util/crc32c.cc:1277:10: error: conflicting declaration of ‘uint32_t rocksdb::crc32c::Extend(uint32_t, const char*, size_t)’ with ‘C’ linkage
 1277 | uint32_t Extend(uint32_t crc, const char* buf, size_t size) {
      | ^~~~~~
In file included from util/crc32c.cc:12:
./util/crc32c.h:25:17: note: previous declaration with ‘C++’ linkage
   25 | extern uint32_t Extend(uint32_t init_crc, const char* data, size_t n);
      | ^~~~~~
util/crc32c.cc:1283:1: error: expected ‘}’ at end of input
 1283 | } // namespace ROCKSDB_NAMESPACE
      | ^
In file included from ./util/crc32c_arm64.h:16,
                 from util/crc32c.cc:21:
/usr/lib/gcc/aarch64-linux-gnu/9/include/arm_acle.h:33:12: note: to match this ‘{’
   33 | extern "C" {
      | ^
Makefile:2272: recipe for target 'util/crc32c.o' failed
make: *** [util/crc32c.o] Error 1
===========================================================

The latest patch of GCC 9.4.0 release: https://github.com/gcc-mirror/gcc/commit/6f06be1769d45359940c60517f9d55bedd3cb1f4#diff-64cabf812b3706ffd3c5ab7c6048c3617a406f029631d0427d3cfb896fd8dbf3R32 introduce a lonely induce that build issue:
#ifdef __cplusplus
extern "C" {
#endif