-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Environment
OS: Amazon Linux 2023
Ruby version: 3.2.8
roaring gem version: 0.4.0
Installed with: bundle install
Steps to Reproduce
On Amazon Linux 2023, run bundle install with a Gemfile that includes gem 'roaring'.
Use the gem in your code.
The following error occurs:
$HOME/.local/share/gem/ruby/gems/roaring-0.4.0/lib/roaring.rb:4:in `require_relative': cannot load such file -- $HOME/.local/share/gem/ruby/gems/roaring-0.4.0/lib/roaring/roaring (LoadError)
Root Cause
In lib/roaring.rb:
require_relative "roaring/roaring"
This tries to load the native extension .so file via relative path, but on this environment, the .so file is installed in:
.local/share/gem/ruby/extensions/aarch64-linux/3.2.0/roaring-0.4.0/roaring/roaring.so
So the relative path does not resolve correctly.
Proposed Solution
Change:
require_relative "roaring/roaring"
to:
require "roaring/roaring"
Using require lets Ruby find the extension via the $LOAD_PATH, which resolves correctly.
Additional Context
This issue may affect other non-standard environments or architectures that install native extensions in a separate directory.
Workaround confirmed: modifying lib/roaring.rb as above works.
I would appreciate your help.