[Bug]: Proto_library fails to build with abseil-cpp version = "20240116.0"
Closed this issue · 2 comments
Describe the issue
I want to compile proto with latest version 20240116.1, but fail to compile. Not sure what the cause is.
What has been working is to roll back to version 20230802.0. What might be the cause of the issue?
Steps to reproduce the problem
proto
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.sample";
option java_outer_classname = "SampleProto";
option objc_class_prefix = "HLW";
package sample;
// The sample service definition.
service ProcessSample {
// Sends a transaction
rpc ProcessTransaction (ProcessTransactionRequest) returns (ProcessTransactionResponse) {}
}
BUILD file
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
package(default_visibility = ["//visibility:public"])
proto_library(
name = "sample_proto",
srcs = ["sample.proto"],
)
In the MODULE.bazel, I have declare below but bazel doesn't compile. Logs show below.
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "protobuf", version = "23.1")
bazel_dep(name = "grpc", version = "1.56.3")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
bazel_dep(name = "zlib", version = "1.3")
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest")
# =========================================
# Cpp dependencies
# =========================================
bazel_dep(name = "abseil-cpp", version = "20240116.0")
bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
Log
INFO: Analyzed target //src/proto:sample_proto (86 packages loaded, 1340 targets configured).
INFO: Found 1 target...
ERROR: /home/user/.cache/bazel/_bazel_user/36085a489d0698627f098f95cacee125/external/protobuf~23.1/src/google/protobuf/BUILD.bazel:318:11: Compiling src/google/protobuf/arena.cc [for tool] failed: (Exit 1): gcc failed: error executing command (from target @protobuf~23.1//src/google/protobuf:arena)
(cd /home/user/.cache/bazel/_bazel_user/36085a489d0698627f098f95cacee125/sandbox/linux-sandbox/884/execroot/_main && \
exec env - \
PATH='/home/user/.vscode/cli/servers/Stable-019f4d1419fbc8219a181fab7892ebccf7ee29a2/server/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA App/NvDLISR:/mnt/c/Users/draly/AppData/Local/Programs/Python/Python312/Scripts/:/mnt/c/Users/draly/AppData/Local/Programs/Python/Python312/:/mnt/c/Users/draly/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/draly/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/draly/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/draly/.dotnet/tools:/snap/bin' \
PWD=/proc/self/cwd \
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_objs/arena/arena.d '-frandom-seed=bazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_objs/arena/arena.o' '-DBAZEL_CURRENT_REPOSITORY="protobuf~23.1"' -iquote external/protobuf~23.1 -iquote bazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1 -iquote external/abseil-cpp~20240116.0 -iquote bazel-out/k8-opt-exec-2B5CBBC6/bin/external/abseil-cpp~20240116.0 -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/arena -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/arena_align -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/stubs/_virtual_includes/lite -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/port_def -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/arena_allocation_policy -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/arena_config -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/arena_cleanup -Ibazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_virtual_includes/string_block -g0 -g0 '-std=c++23' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/protobuf~23.1/src/google/protobuf/arena.cc -o bazel-out/k8-opt-exec-2B5CBBC6/bin/external/protobuf~23.1/src/google/protobuf/_objs/arena/arena.o)
# Configuration: a95b69ee4c4c959853d22e8caf204e1bd3ec4f72282af74cb657a29833555e5d
# Execution platform: @local_config_platform//:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/protobuf~23.1/src/google/protobuf/arena.cc:472:49: error: 'Layout' in namespace 'absl::lts_20240116::container_internal' does not name a template type
472 | using layout_type = absl::container_internal::Layout<
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc:494:20: error: 'layout_type' does not name a type
494 | constexpr static layout_type Layout(size_t n) {
| ^~~~~~~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'absl::lts_20240116::Span<const std::atomic<void*> > google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ids() const':
external/protobuf~23.1/src/google/protobuf/arena.cc:417:12: error: 'Layout' was not declared in this scope
417 | return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc:417:50: error: request for member 'first' in '((const google::protobuf::internal::ThreadSafeArena::SerialArenaChunk*)this)->google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ptr()', which is of non-class type 'const char*'
417 | return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
| ^~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'absl::lts_20240116::Span<std::atomic<void*> > google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ids()':
external/protobuf~23.1/src/google/protobuf/arena.cc:420:12: error: 'Layout' was not declared in this scope
420 | return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc:420:50: error: request for member 'first' in '((google::protobuf::internal::ThreadSafeArena::SerialArenaChunk*)this)->google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ptr()', which is of non-class type 'char*'
420 | return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
| ^~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'std::atomic<void*>& google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::id(uint32_t)':
external/protobuf~23.1/src/google/protobuf/arena.cc:424:12: error: 'Layout' was not declared in this scope
424 | return Layout(capacity()).Pointer<kIds>(ptr())[i];
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'absl::lts_20240116::Span<const std::atomic<google::protobuf::internal::SerialArena*> > google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::arenas() const':
external/protobuf~23.1/src/google/protobuf/arena.cc:429:12: error: 'Layout' was not declared in this scope
429 | return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc:429:53: error: request for member 'first' in '((const google::protobuf::internal::ThreadSafeArena::SerialArenaChunk*)this)->google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ptr()', which is of non-class type 'const char*'
429 | return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
| ^~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'absl::lts_20240116::Span<std::atomic<google::protobuf::internal::SerialArena*> > google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::arenas()':
external/protobuf~23.1/src/google/protobuf/arena.cc:432:12: error: 'Layout' was not declared in this scope
432 | return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc:432:53: error: request for member 'first' in '((google::protobuf::internal::ThreadSafeArena::SerialArenaChunk*)this)->google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::ptr()', which is of non-class type 'char*'
432 | return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
| ^~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'const std::atomic<google::protobuf::internal::SerialArena*>& google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::arena(uint32_t) const':
external/protobuf~23.1/src/google/protobuf/arena.cc:436:12: error: 'Layout' was not declared in this scope
436 | return Layout(capacity()).Pointer<kArenas>(ptr())[i];
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'std::atomic<google::protobuf::internal::SerialArena*>& google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::arena(uint32_t)':
external/protobuf~23.1/src/google/protobuf/arena.cc:440:12: error: 'Layout' was not declared in this scope
440 | return Layout(capacity()).Pointer<kArenas>(ptr())[i];
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In static member function 'static constexpr size_t google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::AllocSize(size_t)':
external/protobuf~23.1/src/google/protobuf/arena.cc:465:56: error: 'Layout' was not declared in this scope
465 | constexpr static size_t AllocSize(size_t n) { return Layout(n).AllocSize(); }
| ^~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'google::protobuf::internal::SerialArenaChunkHeader& google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::header()':
external/protobuf~23.1/src/google/protobuf/arena.cc:479:13: error: 'layout_type' has not been declared
479 | return *layout_type::Partial().Pointer<kHeader>(ptr());
| ^~~~~~~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In member function 'const google::protobuf::internal::SerialArenaChunkHeader& google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::header() const':
external/protobuf~23.1/src/google/protobuf/arena.cc:482:13: error: 'layout_type' has not been declared
482 | return *layout_type::Partial().Pointer<kHeader>(ptr());
| ^~~~~~~~~~~
external/protobuf~23.1/src/google/protobuf/arena.cc: In static member function 'static google::protobuf::internal::ThreadSafeArena::SerialArenaChunk* google::protobuf::internal::ThreadSafeArena::NewSerialArenaChunk(uint32_t, void*, google::protobuf::internal::SerialArena*)':
external/protobuf~23.1/src/google/protobuf/arena.cc:627:61: in 'constexpr' expansion of 'google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::AllocSize(0)'
external/protobuf~23.1/src/google/protobuf/arena.cc:627:63: error: 'constexpr' call flows off the end of the function
627 | constexpr size_t kHeaderSize = SerialArenaChunk::AllocSize(0);
| ^
external/protobuf~23.1/src/google/protobuf/arena.cc:628:60: in 'constexpr' expansion of 'google::protobuf::internal::ThreadSafeArena::SerialArenaChunk::AllocSize(1)'
external/protobuf~23.1/src/google/protobuf/arena.cc:628:66: error: 'constexpr' call flows off the end of the function
628 | constexpr size_t kEntrySize = SerialArenaChunk::AllocSize(1) - kHeaderSize;
| ^~~~~~~~~~~
Target //src/proto:sample_proto failed to build
INFO: Elapsed time: 13.947s, Critical Path: 2.93s
INFO: 107 processes: 18 internal, 89 linux-sandbox.
FAILED: Build did NOT complete successfully
Temporary solution
Version 20230802.0 works. What might be the cause of the issue?
What version of Abseil are you using?
bazel_dep(name = "abseil-cpp", version = "20240116.1")
What operating system and version are you using?
Ubuntu subsystem in windows 11
What compiler and version are you using?
gcc -v
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
In .bazelrc
build --cxxopt=-std=c++23
build --host_cxxopt=-std=c++23
What build system are you using?
bazel 6.3.2
Additional context
No response
This looks like it is probably a protobuf issue to me. I think your compiler doesn't like the ordering of some of the definitions in google/protobuf/arena.cc
. You should move this issue to https://github.com/protocolbuffers/protobuf.
Thanks Derek! Moved discussion to protocolbuffers/protobuf#16186 (comment).