It's been hours that I'm trying to understand the error but I don't get it.
I have tried to upgrade my ruby version from 2.5 to 2.7.4
I first update rbenv
from brew
then install the 2.7.4 version and used rbenv rehash
But now whenever I launch rails c
or rails s
, I've got the following errors:
Loading development environment variables
- load /Users/myself/Work/my-app/.env
/Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': dlopen(/Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/bundler/gems/gdal-ruby-1820e1643725/lib/gdal-ruby/gdal.bundle, 9): Symbol not found: __ZN6libdap5ErrorD1Ev
Referenced from: /usr/local/opt/gdal/lib/libgdal.28.dylib
Expected in: /usr/local/opt/libdap/lib/libdap.27.dylib
in /usr/local/opt/gdal/lib/libgdal.28.dylib - /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/bundler/gems/gdal-ruby-1820e1643725/lib/gdal-ruby/gdal.bundle (LoadError)
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/bundler/gems/gdal-ruby-1820e1643725/lib/gdal.rb:2:in `<main>'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/bundler.rb:174:in `require'
from /Users/myself/Work/my-app/config/application.rb:9:in `<top (required)>'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `preload'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
from /Users/myself/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
I have tried to reinstall rbenv from brew but didn't work, I have spent hours to try to understand what this error means but as a beginner I don't get it.
What should I look for ?
EDIT: It's not from bootsnap since I've got the same problem if I remove bootsnap
CodePudding user response:
Some dependencies of your existing gems may have been updated during an (implicit) brew upgrade
run as you installed additional software.
When installing gems which use library dependencies (such as libgdal
in your case), those gems may sometimes need to be re-compiled if the underlying library has changed in incompatible ways.
As such, a common first attempt to fix this to re-install the affected gem. If you use bundler, you can re-install all gems of your project by running
bundle pristine
This should ensure that your bundler-managed gems all use the latest versions of your libraries. See the documentation of bundle pristine
for details of what this command does under the hood.