jdx / mise

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

Ruby fails to install #2863

Closed svipas closed 6 days ago

svipas commented 6 days ago

Describe the bug

Ruby fails to install on macOS.

To Reproduce

mise use -g ruby

Expected behavior

To install without failing.

mise doctor output

version: 2024.10.13 macos-arm64 (ee83488 2024-10-28)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Mon, 28 Oct 2024 03:24:44 +0000
  Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (arm64-apple-darwin24.0)

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

config_files:
  ~/.config/mise/config.toml

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:
  python@3.13.0

env_vars:
  MISE_SHELL=zsh

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cache_prune_age = "30d"
  ci = false
  color = true
  debug = false
  disable_backends = []
  disable_default_registry = false
  disable_hints = []
  disable_tools = []
  experimental = false
  fetch_remote_versions_cache = "1h"
  fetch_remote_versions_timeout = "10s"
  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
  http_timeout = "30s"
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  lockfile = false
  log_level = "info"
  not_found_auto_install = true
  paranoid = false
  pin = false
  plugin_autoupdate_last_check_duration = "7d"
  quiet = false
  raw = false
  trace = false
  trusted_config_paths = []
  use_versions_host = true
  verbose = false
  yes = false

  [cargo]
  binstall = true

  [node]

  [pipx]
  uvx = false

  [python]
  default_packages_file = "~/.default-python-packages"
  pyenv_repo = "https://github.com/pyenv/pyenv.git"
  venv_auto_create = false
  venv_stdlib = false

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false
No warnings found
No problems found

Additional context

*** Following extensions are not compiled:
psych:
    Could not be configured. It will not be installed.
    Check ext/psych/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
make[1]: *** [note] Error 1
make: *** [build-ext] Error 2
external command failed with status 2

BUILD FAILED (macOS 15.0.1 on arm64 using ruby-build 20241017)

You can inspect the build directory at /var/folders/tz/ycrpdsf17r31l4lhxjh1kxk80000gn/T/ruby-build.20241029145511.90812.1GJIkv
Error: 
   0: Failed to install ruby@3.3.5
   1: ~/Library/Caches/mise/ruby/ruby-build/bin/ruby-build exited with non-zero status: exit code 1

Location:
   src/cmd.rs:423

Version:
   2024.10.13 macos-arm64 (ee83488 2024-10-28)

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 3 frames hidden ⋮                               
   4: mise::cmd::CmdLineRunner::on_error::hf615ebd987a0ed39
      at <unknown source file>:<unknown line>
   5: mise::cmd::CmdLineRunner::execute::h2708c782ae3118c9
      at <unknown source file>:<unknown line>
   6: <mise::plugins::core::ruby::RubyPlugin as mise::backend::Backend>::install_version_impl::he30d87236d7485be
      at <unknown source file>:<unknown line>
   7: mise::backend::Backend::install_version::he446a1d03446d17c
      at <unknown source file>:<unknown line>
   8: std::sys::backtrace::__rust_begin_short_backtrace::hbbe0c99e6b6c1133
      at <unknown source file>:<unknown line>
   9: core::ops::function::FnOnce::call_once{{vtable.shim}}::h4fa79969043d16ac
      at <unknown source file>:<unknown line>
  10: std::sys::pal::unix::thread::Thread::new::thread_start::hd88bc8e95f2ca709
      at <unknown source file>:<unknown line>
  11: __pthread_deallocate<unknown>
      at <unknown source file>:<unknown line>

ext/psych/mkmf.log output

───────┬────────────────────────────────────────────────────────────────────────
       │ File: ext/psych/mkmf.log
───────┼────────────────────────────────────────────────────────────────────────
   1   │ pkg_config: checking for pkg-config for yaml-0.1... -------------------
       │ - not found
   2   │ 
   3   │ package configuration for yaml-0.1 is not found
   4   │ --------------------
   5   │ 
   6   │ find_header: checking for yaml.h... -------------------- no
   7   │ 
   8   │ DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/arm64
       │ -darwin24 -I../.././include -I../.././ext/psych -D_XOPEN_SOURCE -D_DARW
       │ IN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fdeclspec -O3 -f
       │ no-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarati
       │ ons -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -W
       │ implicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-s
       │ tyle-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constan
       │ t-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-o
       │ verlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tauto
       │ logical-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variab
       │ le -Wmisleading-indentation -Wundef -fno-common -pipe conftest.c  -L. -
       │ L../.. -L. -fstack-protector-strong  -arch arm64   -lruby.3.3-static -f
       │ ramework CoreFoundation -ldl -lobjc -lpthread   -lpthread  "
   9   │ ld: warning: ignoring duplicate libraries: '-lpthread'
  10   │ checked program was:
  11   │ /* begin */
  12   │ 1: #include "ruby.h"
  13   │ 2: 
  14   │ 3: int main(int argc, char **argv)
  15   │ 4: {
  16   │ 5:   return !!argv[argc];
  17   │ 6: }
  18   │ /* end */
  19   │ 
  20   │ DYLD_LIBRARY_PATH=.:../.. "clang -I../../.ext/include/arm64-darwin24 -I
       │ ../.././include -I../.././ext/psych -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE 
       │ -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fdeclspec -O3 -fno-fast-math
       │  -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivisi
       │ on-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int
       │  -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definit
       │ ion -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-op
       │ erand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-st
       │ rings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-comp
       │ are -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmislead
       │ ing-indentation -Wundef -fno-common -pipe -arch arm64  -c conftest.c"
  21   │ conftest.c:3:10: fatal error: 'yaml.h' file not found
  22   │     3 | #include <yaml.h>
  23   │       |          ^~~~~~~~
  24   │ 1 error generated.
  25   │ checked program was:
  26   │ /* begin */
  27   │ 1: #include "ruby.h"
  28   │ 2: 
  29   │ 3: #include <yaml.h>
  30   │ /* end */
  31   │ 
  32   │ --------------------
  33   │ 
───────┴────────────────────────────────────────────────────────────────────────
svipas commented 6 days ago

@jdx this happened to me on two different machines, I remember like a month ago, but did mise self-update and it started to work again, now I tried to install Ruby on new machine and it failed with latest current version.

svipas commented 6 days ago

@jdx Was able to fix it by first running brew install libyaml, but my question is maybe somehow it is possible to skip this part so that mise handles it? But anyways, if thats the requirement please feel free to close my ticket.

roele commented 6 days ago

mise uses ruby-build under the hood and since dependencies might change or even differ between installed ruby versions, mise should not handle those. What we should do is add a hint in the documentation which refers to https://github.com/rbenv/ruby-build/wiki#suggested-build-environment.

svipas commented 6 days ago

Thanks @roele