You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2025/12/04 21:27:00 UTC

[jira] [Assigned] (THRIFT-5475) shorten-64-to-32 errors compilation errors on macOS

     [ https://issues.apache.org/jira/browse/THRIFT-5475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer reassigned THRIFT-5475:
----------------------------------

    Assignee: Jean Boussier  (was: Jens Geyer)

> shorten-64-to-32 errors compilation errors on macOS
> ---------------------------------------------------
>
>                 Key: THRIFT-5475
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5475
>             Project: Thrift
>          Issue Type: Bug
>          Components: Ruby - Library
>            Reporter: Jean Boussier
>            Assignee: Jean Boussier
>            Priority: Major
>             Fix For: 0.22.0
>
>
> The ruby gem fail to compile on newer macOS versions, presumably because of a new clang warning.
>  
> I provided a patch for it here: [https://github.com/apache/thrift/pull/2464]
>  
> On a sidenote, it's not recommended for Ruby native extensions to set `-Wall` outside of their own CI environment for this exact reason. Newer compilers get stricter, and the gem becomes unusable. 
> ```
>  
> {{$ ruby --version
> ruby 3.1.0dev (2021-10-06T06:42:37Z master d53493715c) [x86_64-darwin20]
> $ gem install thrift
> Building native extensions. This could take a while...
> ERROR:  Error installing thrift:
> 	ERROR: Failed to build gem native extension.
>     current directory: /Users/byroot/.gem/ruby/3.1.0/gems/thrift-0.15.0/ext
> /opt/rubies/3.1.0-dev/bin/ruby -I /opt/rubies/3.1.0-dev/lib/ruby/3.1.0 -r ./siteconf20211013-11520-x7l42b.rb extconf.rb
> checking for strlcpy() in string.h... yes
> creating Makefile
> current directory: /Users/byroot/.gem/ruby/3.1.0/gems/thrift-0.15.0/ext
> make DESTDIR\= clean
> current directory: /Users/byroot/.gem/ruby/3.1.0/gems/thrift-0.15.0/ext
> make DESTDIR\=
> compiling binary_protocol_accelerated.c
> binary_protocol_accelerated.c:85:27: error: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Werror,-Wshorten-64-to-32]
>   write_i32_direct(trans, RSTRING_LEN(str));
>   ~~~~~~~~~~~~~~~~        ^~~~~~~~~~~~~~~~
> /opt/rubies/3.1.0-dev/include/ruby-3.1.0/ruby/internal/core/rstring.h:50:27: note: expanded from macro 'RSTRING_LEN'
> #define RSTRING_LEN       RSTRING_LEN
>                           ^
> binary_protocol_accelerated.c:226:27: error: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Werror,-Wshorten-64-to-32]
>   write_i32_direct(trans, RSTRING_LEN(buf));
>   ~~~~~~~~~~~~~~~~        ^~~~~~~~~~~~~~~~
> /opt/rubies/3.1.0-dev/include/ruby-3.1.0/ruby/internal/core/rstring.h:50:27: note: expanded from macro 'RSTRING_LEN'
> #define RSTRING_LEN       RSTRING_LEN
>                           ^
> binary_protocol_accelerated.c:406:15: error: implicit conversion loses integer precision: 'long long' to 'int' [-Werror,-Wshorten-64-to-32]
>   VERSION_1 = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_1")));
>             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> binary_protocol_accelerated.c:407:18: error: implicit conversion loses integer precision: 'long long' to 'int' [-Werror,-Wshorten-64-to-32]
>   VERSION_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_MASK")));
>                ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> binary_protocol_accelerated.c:408:15: error: implicit conversion loses integer precision: 'long long' to 'int' [-Werror,-Wshorten-64-to-32]
>   TYPE_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("TYPE_MASK")));
>             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 5 errors generated.
> make: *** [binary_protocol_accelerated.o] Error 1}}
> {{```}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)