jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.15k stars 248 forks source link

Ruby plugin's ruby fails to `bundle install` with "LoadError: incompatible library version" #1858

Open offbyone opened 5 months ago

offbyone commented 5 months ago

Describe the bug I am switching from asdf to mise, and have found that the ruby installed by mise is unable to bundle install some of my gems.

Running bundle install results in this:

$ bundle install
Ignoring psych-5.1.2 because its extensions are not built. Try: gem pristine psych --version 5.1.2
Ignoring stringio-3.1.0 because its extensions are not built. Try: gem pristine stringio --version 3.1.0
--- ERROR REPORT TEMPLATE -------------------------------------------------------

LoadError: incompatible library version - /Users/offbyone/[redacted]/vendor/gems/ruby/3.1.0/gems/psych-5.1.2/lib/psych.bundle
... a whole big report

To Reproduce

Expected behavior

"bundle install" should work :D

Extra Context

The ruby versions are subtly different:

$ asdf exec ruby --version
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [arm64-darwin22]
$ ruby --version
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [arm64-darwin23]

The bundle environments are also subtly different:

--- /Users/offbyone/tmp/asdf-bundle-env 2024-04-04 08:24:29
+++ /Users/offbyone/tmp/mise-bundle-env 2024-04-04 08:24:34
@@ -2,16 +2,16 @@

 Bundler       2.4.10
-  Platforms   ruby, arm64-darwin-22
-Ruby          3.1.4p223 (2023-03-30 revision 957bb7cb81995f26c671afce0ee50a5c660e540e) [arm64-darwin-22]
-  Full Path   /Users/offbyone/.asdf/installs/ruby/3.1.4/bin/ruby
-  Config Dir  /Users/offbyone/.asdf/installs/ruby/3.1.4/etc
+  Platforms   ruby, arm64-darwin-23
+Ruby          3.1.4p223 (2023-03-30 revision 957bb7cb81995f26c671afce0ee50a5c660e540e) [arm64-darwin-23]
+  Full Path   /Users/offbyone/.local/share/mise/installs/ruby/3.1.4/bin/ruby
+  Config Dir  /Users/offbyone/.local/share/mise/installs/ruby/3.1.4/etc
 RubyGems      3.3.26
-  Gem Home    /Users/offbyone/[redacted]/vendor
-  Gem Path    /Users/offbyone/.gem/ruby/3.1.0:/Users/offbyone/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0:/Users/offbyone/[redacted]/vendor
+  Gem Home    /Users/offbyone/[redacted]/vendor/gems/ruby/3.1.0
+  Gem Path    /Users/offbyone/[redacted]/vendor/gems/ruby/3.1.0
   User Home   /Users/offbyone
   User Path   /Users/offbyone/.gem/ruby/3.1.0
-  Bin Dir     /Users/offbyone/[redacted]/vendor/bin
+  Bin Dir     /Users/offbyone/[redacted]/vendor/gems/ruby/3.1.0/bin
 Tools         
   Git         2.44.0
   RVM         not installed
@@ -50,6 +50,8 @@
   Set for the current user (/Users/offbyone/.bundle/config): "true"
 gem.test
   Set for the current user (/Users/offbyone/.bundle/config): false
+gemfile
+  Set via BUNDLE_GEMFILE: "/Users/offbyone/[redacted]/Gemfile"
 path
   Set for your local app (/Users/offbyone/[redacted]/.bundle/config): "vendor/gems"
 rubygems.pkg.github.com

mise doctor output

version: 2024.4.0 macos-arm64 (2024-04-02)
activated: yes
shims_on_path: no

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Tue, 2 Apr 2024 01:55:39 +0000
  Rust Version: rustc 1.77.1 (7cf61ebde 2024-03-27) (Homebrew)
  Profile: release

shell: 
  /opt/homebrew/bin/fish
  fish, version 3.7.1

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.tool-versions
  ~/.config/mise/config.toml
  ~/[redacted]/.node-version
  ~/[redacted]/.ruby-version
  ~/[redacted]/Gemfile
  ~/[redacted]/.tool-versions

plugins: 
  act               https://github.com/grimoh/asdf-act.git#bfc9331
  action-validator  https://github.com/mpalmer/action-validator.git#d064028
  awscli            https://github.com/MetricMike/asdf-awscli.git#2e31396
  azure-cli         https://github.com/EcoMind/asdf-azure-cli.git#4735c27
  bun               (core)
  deno              (core)
  erlang            (core)
  git-chglog        https://github.com/GoodwayGroup/asdf-git-chglog.git#ef79c13
  go                (core)
  java              (core)
  kubectl           https://github.com/asdf-community/asdf-kubectl.git#cbe6df4
  ninja             https://github.com/asdf-community/asdf-ninja.git#267f56b
  node              (core)
  pre-commit        https://github.com/jonathanmorley/asdf-pre-commit.git#26bfc42
  python            (core)
  ruby              (core)
  rust-analyzer     https://github.com/Xyven1/asdf-rust-analyzer#301bc6a
  shfmt             https://github.com/luizm/asdf-shfmt.git#a42c5ff
  tflint            https://github.com/skyzyx/asdf-tflint.git#37e7eb9
  usage             https://github.com/jdx/mise-usage.git#fe3888a
  wasmtime          https://github.com/tachyonicbytes/asdf-wasmtime#6699afa

toolset: 
  ruby@3.1.4            
  node@16.13.2          
  usage@0.1.17          
  python@3.12.2         
  npm:yarn@1.22.22      
  npm:prettier@3.2.5    
  npm:pyright@1.1.357   
  npm:lerna@8.1.2       
  go@1.22.2             
  act@0.2.42            
  action-validator@0.3.0  
  awscli@2.9.23         
  git-chglog@0.15.3     
  java@openjdk-17.0.1   
  pre-commit@2.20.0     
  shfmt@3.5.1           
  tflint@0.45.0         
  ninja@1.11.1          
  azure-cli@2.45.0      
  direnv@system         
  rust-analyzer@2023-05-22  
  kubectl@1.27.3        

env_vars: 
  MISE_SHELL=fish

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/Users/offbyone/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No problems found

Additional context Add any other context about the problem here.

louim commented 5 months ago

Hey! I encountered the same problem and was able to get it working by doing:

rm -rf ~/.local/share/gem
rm -rf ~/.gem
bundle install --redownload

It seems like some paths are shared between the install and it caused incompatibilities.

offbyone commented 5 months ago

Oof. This is so close but I'm still having errors with C extensions, because apparently the source is not installed. Looking into it (I'm hoping it's a plugin option)

louim commented 5 months ago

I'm battling the same problem currently. I was getting really cryptic errors like running gem info would fail and say something about stringIO gem linking to and old cache path that referenced asdf. I seem to have fixed the problems (for now) with:

Hopefully you have the same luck!