Skip to content

Conversation

@SpringMT
Copy link
Owner

@SpringMT SpringMT commented Nov 2, 2025

Problem

When building the gem on macOS, the following linker error occurs:

Undefined symbols for architecture arm64:
  "_ruby_abi_version", referenced from:
      <initial-undefines>
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

This PR replaces the static exports.txt with dynamic export file selection based on Ruby version, following grpc's approach.

Changes:

  • Remove exports.txt
  • Add ext-export.txt (for release versions)
  • Add ext-export-with-ruby-abi-version.txt (for development versions)
  • Update extconf.rb to dynamically select the appropriate export file based on Ruby version

How it works:

  • For Ruby release versions (e.g., 3.2.4): Uses ext-export.txt which only exports Init_zstdruby. Ruby itself provides ruby_abi_version.
  • For Ruby development versions (e.g., 3.3.0-dev): Uses ext-export-with-ruby-abi-version.txt as needed.

Related Issues:

Replace static exports.txt with dynamic export file selection based on
Ruby version, following grpc's approach.

Changes:
- Remove exports.txt
- Add ext-export.txt (for release versions)
- Add ext-export-with-ruby-abi-version.txt (for dev versions)
- Update extconf.rb to dynamically select export file based on Ruby version

This fixes the 'Undefined symbols: _ruby_abi_version' linker error
that occurs when building the gem.

Related:
- https://bugs.ruby-lang.org/issues/19289
- grpc/grpc#31970
- #117
@SpringMT SpringMT merged commit f4b0117 into main Nov 2, 2025
10 checks passed
@SpringMT SpringMT deleted the fix-ruby-abi-version-symbol-error branch November 2, 2025 14:13
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.

2 participants