Skip to content

Bug Report: LoadError when using roaring gem on Amazon Linux 2023 #3

@S-Iked

Description

@S-Iked

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions