Skip to content

ruby gem for v27.2 fails to build with gcc 14 #17266

Closed
@loqs

Description

What version of protobuf and what language are you using?
Version: v27.2 63def39
Language: Ruby
What operating system (Linux, Windows, ...) and version?
Arch Linux rolling
What runtime / compiler are you using (e.g., python version or gcc version)

$ gcc --version
gcc (GCC) 14.1.1 20240522
Copyright (C) 2024 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.

$ ruby --version
ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux]

What did you do?
Steps to reproduce the behavior:

$ curl -o protobuf-27.2.tar.gz https://github.com/protocolbuffers/protobuf/archive/v27.2/protobuf-27.2.tar.gz
$ cd protobuf-27.2/ruby
$ rake

What did you expect to see
The extension for the ruby protobuf gem build without error.
What did you see instead?
The build failing due to the compiler detecting an incompatible pointer type conversion

compiling ../../../../ext/google/protobuf_c/shared_message.c
../../../../ext/google/protobuf_c/defs.c: In function ‘MethodDescriptor_initialize’:
../../../../ext/google/protobuf_c/defs.c:1513:19: error: assignment to ‘const upb_MethodDef *’ from incompatible pointer type ‘const upb_ServiceDef *’ [-Wincompatible-pointer-types]
 1513 |   self->methoddef = (const upb_ServiceDef*)NUM2ULL(ptr);
      |                   ^
make: *** [Makefile:247: defs.o] Error 1
make: *** Waiting for unfinished jobs....
rake aborted!

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

$ rake
rm -f lib/google/protobuf/any_pb.rb lib/google/protobuf/api_pb.rb lib/google/protobuf/descriptor_pb.rb lib/google/protobuf/duration_pb.rb lib/google/protobuf/empty_pb.rb lib/google/protobuf/field_mask_pb.rb lib/google/protobuf/source_context_pb.rb lib/google/protobuf/struct_pb.rb lib/google/protobuf/timestamp_pb.rb lib/google/protobuf/type_pb.rb lib/google/protobuf/wrappers_pb.rb tests/basic_test_pb.rb tests/basic_test_features_pb.rb tests/basic_test_proto2_pb.rb tests/generated_code_pb.rb tests/generated_code_proto2_pb.rb tests/generated_code_editions_pb.rb tests/multi_level_nesting_test_pb.rb tests/repeated_field_test_pb.rb tests/service_test_pb.rb tests/stress_pb.rb tests/test_import_pb.rb tests/test_import_proto2_pb.rb tests/test_ruby_package_pb.rb tests/test_ruby_package_proto2_pb.rb
rm -f google-protobuf-*gem
rm -f Gemfile.lock
rm -rf pkg
rm -rf tmp
protoc -I../src --ruby_out=lib ../src/google/protobuf/any.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/api.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/descriptor.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/duration.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/empty.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/field_mask.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/source_context.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/struct.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/timestamp.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/type.proto
protoc -I../src --ruby_out=lib ../src/google/protobuf/wrappers.proto
protoc -I../src -I./tests --ruby_out=tests  tests/basic_test.proto
protoc -I../src -I./tests --ruby_out=tests  tests/basic_test_features.proto
protoc -I../src -I./tests --ruby_out=tests  tests/basic_test_proto2.proto
protoc -I../src -I./tests --ruby_out=tests  tests/generated_code.proto
protoc -I../src -I./tests --ruby_out=tests  tests/generated_code_proto2.proto
protoc -I../src -I./tests --ruby_out=tests  tests/generated_code_editions.proto
protoc -I../src -I./tests --ruby_out=tests  tests/multi_level_nesting_test.proto
protoc -I../src -I./tests --ruby_out=tests  tests/repeated_field_test.proto
protoc -I../src -I./tests --ruby_out=tests  tests/service_test.proto
protoc -I../src -I./tests --ruby_out=tests  tests/stress.proto
protoc -I../src -I./tests --ruby_out=tests  tests/test_import.proto
protoc -I../src -I./tests --ruby_out=tests  tests/test_import_proto2.proto
protoc -I../src -I./tests --ruby_out=tests  tests/test_ruby_package.proto
protoc -I../src -I./tests --ruby_out=tests  tests/test_ruby_package_proto2.proto
/usr/bin/ruby -I. ../../../../ext/google/protobuf_c/extconf.rb
mkdir -p tmp/x86_64-linux/protobuf_c/3.2.4
cd tmp/x86_64-linux/protobuf_c/3.2.4
creating Makefile
/usr/bin/make
cd -
cd tmp/x86_64-linux/protobuf_c/3.2.4
compiling ../../../../ext/google/protobuf_c/protobuf.c
compiling ../../../../ext/google/protobuf_c/defs.c
compiling ../../../../ext/google/protobuf_c/convert.c
compiling ../../../../ext/google/protobuf_c/message.c
compiling ../../../../ext/google/protobuf_c/repeated_field.c
compiling ../../../../ext/google/protobuf_c/map.c
compiling ../../../../ext/google/protobuf_c/ruby-upb.c
compiling ../../../../ext/google/protobuf_c/wrap_memcpy.c
compiling ../../../../ext/google/protobuf_c/third_party/utf8_range/utf8_range.c
compiling ../../../../ext/google/protobuf_c/shared_convert.c
compiling ../../../../ext/google/protobuf_c/shared_message.c
../../../../ext/google/protobuf_c/defs.c: In function ‘MethodDescriptor_initialize’:
../../../../ext/google/protobuf_c/defs.c:1513:19: error: assignment to ‘const upb_MethodDef *’ from incompatible pointer type ‘const upb_ServiceDef *’ [-Wincompatible-pointer-types]
 1513 |   self->methoddef = (const upb_ServiceDef*)NUM2ULL(ptr);
      |                   ^
make: *** [Makefile:247: defs.o] Error 1
make: *** Waiting for unfinished jobs....
rake aborted!
Command failed with status (2): [/usr/bin/make...]

Tasks: TOP => default => build => compile => compile:x86_64-linux => compile:protobuf_c:x86_64-linux => copy:protobuf_c:x86_64-linux:3.2.4 => tmp/x86_64-linux/protobuf_c/3.2.4/protobuf_c.so
(See full trace by running task with --trace)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions