Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using gem in Ruby 3.2.2 and bundler 2.4.10 #13

Open
fragkakis opened this issue May 31, 2023 · 4 comments
Open

Problem using gem in Ruby 3.2.2 and bundler 2.4.10 #13

fragkakis opened this issue May 31, 2023 · 4 comments

Comments

@fragkakis
Copy link

When we were on ruby 2.7.7 and bundler 2.3.14 bundle install produced an .so file. When we upgraded our project to ruby 3.2.2 and bundler 2.4.10, we had to drop the gem as a dependency because the .so file is no longer being created. Bundle install works, but when I try to run our unit tests I am getting the error in the end.

Is the gem usable with the new versions of ruby and bundler?

/bin/zsh -c "bash -c '/Users/markosfragkakis/.rvm/bin/rvm ruby-3.2.2 do /Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/bin/ruby -x /Users/markosfragkakis/dev/workable/bin/bundle exec /Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/bin/ruby -Itest /Applications/RubyMine.app/Contents/plugins/ruby/rb/testing/runner/minitest_runner.rb --name '\"'\"'/^test_has_many_assessment_integrations$/'\"'\"''"
Testing started at 7:40 PM ...
/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/ffi-1.15.5/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.bundle': dlopen(/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.bundle, 0x0005): tried: '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.bundle' (no such file), '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/ext/levenshtein/levenshtein.bundle' (no such file). (LoadError)
Could not open library '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.so': dlopen(/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.so, 0x0005): tried: '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.so' (no such file), '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/ext/levenshtein/levenshtein.so' (no such file).
Could not open library '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.dylib': dlopen(/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.dylib, 0x0005): tried: '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein.dylib' (no such file), '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/ext/levenshtein/levenshtein.dylib' (no such file).
Could not open library '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein': dlopen(/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein, 0x0005): tried: '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/../ext/levenshtein/levenshtein' (no such file), '/Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/ext/levenshtein/levenshtein' (no such file)
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/ffi-1.15.5/lib/ffi/library.rb:99:in `map'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/ffi-1.15.5/lib/ffi/library.rb:99:in `ffi_lib'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/levenshtein.rb:10:in `singleton class'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/levenshtein.rb:4:in `<module:Levenshtein>'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/levenshtein.rb:3:in `<main>'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:332:in `block in require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:332:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/levenshtein-ffi-1.1.0/lib/levenshtein-ffi.rb:1:in `<main>'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler/runtime.rb:55:in `each'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler/runtime.rb:55:in `block in require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler/runtime.rb:44:in `each'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler/runtime.rb:44:in `require'
	from /Users/markosfragkakis/.rvm/gems/ruby-3.2.2/gems/bundler-2.4.10/lib/bundler.rb:196:in `require'
	from /Users/markosfragkakis/dev/workable/config/application.rb:12:in `<top (required)>'
	from /Users/markosfragkakis/dev/workable/config/environment.rb:2:in `require_relative'
	from /Users/markosfragkakis/dev/workable/config/environment.rb:2:in `<top (required)>'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/markosfragkakis/dev/workable/test/test_helper.rb:6:in `<top (required)>'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/markosfragkakis/dev/workable/test/models/account_test.rb:1:in `<top (required)>'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/markosfragkakis/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Applications/RubyMine.app/Contents/plugins/ruby/rb/testing/runner/minitest_runner.rb:12:in `block in <main>'
	from /Applications/RubyMine.app/Contents/plugins/ruby/rb/testing/runner/minitest_runner.rb:11:in `each'
	from /Applications/RubyMine.app/Contents/plugins/ruby/rb/testing/runner/minitest_runner.rb:11:in `<main>'

Process finished with exit code 1
@tlvu2697
Copy link

Hi @fragkakis,I encountered the same issue, and I had to manually build the gem to get it to work. You can try following the instructions below; they might help resolve your problem.

  1. Locate the gem path
❯ gem info levenshtein-ffi

*** LOCAL GEMS ***

levenshtein-ffi (1.1.0)
    Author: David Balatero
    Homepage: http://github.com/dbalatero/levenshtein-ffi
    License: BSD 2-Clause
    Installed at: /home/tlvu/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0

    An FFI version of the levenshtein gem.
❯ bundle info levenshtein-ffi
  * levenshtein-ffi (1.1.0)
        Summary: An FFI version of the levenshtein gem.
        Homepage: http://github.com/dbalatero/levenshtein-ffi
        Path: /home/tlvu/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/levenshtein-ffi-1.1.0
  1. Go to the gem location
cd /home/tlvu/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/levenshtein-ffi-1.1.0
  1. Build the gem (reference)
cd ext/levenshtein/ && ruby extconf.rb && make && cd ../..

@harto
Copy link

harto commented Sep 13, 2023

I think this is the underlying cause: rubygems/rubygems#6205

@harto
Copy link

harto commented Sep 13, 2023

And this looks like a proposed fix: #11

@JuanitoFatas
Copy link

ruby 3.1.4p223, rubygems 3.4.19, Bundler 2.4.15 also had this issue and solved by re-build the gem as suggested by this comment, thanks!

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

No branches or pull requests

4 participants