Skip to content

Fix Ruby 3.3 / GCC 15 incompatible pointer type error#6

Open
edusantana wants to merge 2 commits into
brianhempel:masterfrom
edusantana:fix-ruby-3-3-gcc-15-compatibility
Open

Fix Ruby 3.3 / GCC 15 incompatible pointer type error#6
edusantana wants to merge 2 commits into
brianhempel:masterfrom
edusantana:fix-ruby-3-3-gcc-15-compatibility

Conversation

@edusantana

Copy link
Copy Markdown

Problem

GCC 15 (shipped with Ubuntu 26.04) promotes -Wincompatible-pointer-types to a hard error. Two files use RubyInline to compile C extensions at load time, and both trigger this error with Ruby 3.3's updated rb_define_method union-based callback type:

  • lib/fuzzy_tools/helpers.rb — inline C soundex
  • lib/fuzzy_tools/weighted_document_tokens.rb — inline C cosine_similarity_fast

Both files already have a complete pure-Ruby fallback used for JRuby/rbx. The fix extends that fallback to also apply on MRI 3.3+, where the C extensions no longer compile.

Fix

One-line change per file — extend the existing condition:

# before
if RUBY_DESCRIPTION !~ /^ruby/  # rbx, jruby

# after
if RUBY_DESCRIPTION !~ /^ruby/ || RUBY_VERSION >= '3.3'  # rbx, jruby, or MRI 3.3+

Tested on

  • Ruby 3.3.7 / Ubuntu 26.04 LTS / GCC 15.2 ✅
  • Pure-Ruby soundex and cosine_similarity produce correct results (existing pure-Ruby path was already battle-tested for JRuby)

GCC 15 treats -Wincompatible-pointer-types as a hard error. The inline
C soundex implementation triggers this with Ruby 3.3's updated rb_define_method
signature. Fall back to the existing pure-Ruby implementation on MRI 3.3+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant