Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
loqs opened this issue Jun 27, 2024 · 1 comment
Closed

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

loqs opened this issue Jun 27, 2024 · 1 comment
Assignees

Comments

@loqs
Copy link

loqs commented Jun 27, 2024

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)
@loqs loqs added the untriaged auto added to all issues by default when created. label Jun 27, 2024
@zhangskz zhangskz added ruby 27.x and removed untriaged auto added to all issues by default when created. labels Jul 1, 2024
@ntkme
Copy link
Contributor

ntkme commented Jul 2, 2024

I already had a PR #17240 to fix this, @haberman would you mind take a look?

zhangskz pushed a commit that referenced this issue Jul 3, 2024
This PR fixes the following error on windows ruby 3.4 (head):

```
current directory:
D:/a/sass-embedded-host-ruby/sass-embedded-host-ruby/vendor/bundle/ruby/3.4.0+0/gems/google-protobuf-4.27.1/ext/google/protobuf_c
make.exe DESTDIR\= sitearchdir\=./.gem.20240623-6612-4umz58
sitelibdir\=./.gem.20240623-6612-4umz58
generating protobuf_c-x64-mingw-ucrt.def
compiling protobuf.c
compiling convert.c
compiling defs.c
defs.c: In function 'MethodDescriptor_initialize':
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:250: defs.o] Error 1

make failed, exit code 2
```

- Closes #17266

Closes #17240

COPYBARA_INTEGRATE_REVIEW=#17240 from ntkme:fix-ruby-upb-pointer-type 22e9859
PiperOrigin-RevId: 648923147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants