postmodern / chruby

Changes the current Ruby
MIT License
2.85k stars 190 forks source link

Ignoring ... because its extensions are not built #450

Open dentarg opened 3 years ago

dentarg commented 3 years ago

Continuing as requested from https://github.com/postmodern/chruby/pull/431#issuecomment-742793122, when I start tmux, the message Ignoring ... because its extensions are not built ... is printed many times for different gems. Like below.

$ ./scripts/bug_report.sh
Ignoring RedCloth-4.3.2 because its extensions are not built.  Try: gem pristine RedCloth --version 4.3.2
Ignoring bluecloth-2.2.0 because its extensions are not built.  Try: gem pristine bluecloth --version 2.2.0
Ignoring commonmarker-0.20.2 because its extensions are not built.  Try: gem pristine commonmarker --version 0.20.2
Ignoring eventmachine-1.2.7 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.7
Ignoring ffi-1.13.1 because its extensions are not built.  Try: gem pristine ffi --version 1.13.1
Ignoring ffi-1.12.2 because its extensions are not built.  Try: gem pristine ffi --version 1.12.2
Ignoring http-parser-1.2.2 because its extensions are not built.  Try: gem pristine http-parser --version 1.2.2
Ignoring http_parser.rb-0.6.0 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.6.0
Ignoring kgio-2.11.3 because its extensions are not built.  Try: gem pristine kgio --version 2.11.3
Ignoring nio4r-2.5.4 because its extensions are not built.  Try: gem pristine nio4r --version 2.5.4
Ignoring nio4r-2.5.2 because its extensions are not built.  Try: gem pristine nio4r --version 2.5.2
Ignoring nokogiri-1.10.10 because its extensions are not built.  Try: gem pristine nokogiri --version 1.10.10
Ignoring puma-5.1.0 because its extensions are not built.  Try: gem pristine puma --version 5.1.0
Ignoring puma-4.3.5 because its extensions are not built.  Try: gem pristine puma --version 4.3.5
Ignoring puma-3.12.6 because its extensions are not built.  Try: gem pristine puma --version 3.12.6
Ignoring puma-3.12.0 because its extensions are not built.  Try: gem pristine puma --version 3.12.0
Ignoring raindrops-0.19.1 because its extensions are not built.  Try: gem pristine raindrops --version 0.19.1
Ignoring rdiscount-2.2.0.2 because its extensions are not built.  Try: gem pristine rdiscount --version 2.2.0.2
Ignoring redcarpet-3.5.0 because its extensions are not built.  Try: gem pristine redcarpet --version 3.5.0
Ignoring therubyracer-0.12.3 because its extensions are not built.  Try: gem pristine therubyracer --version 0.12.3
Ignoring unf_ext-0.0.7.7 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.7
Ignoring unicorn-5.7.0 because its extensions are not built.  Try: gem pristine unicorn --version 5.7.0
Ignoring websocket-driver-0.7.3 because its extensions are not built.  Try: gem pristine websocket-driver --version 0.7.3
Ignoring yajl-ruby-1.4.1 because its extensions are not built.  Try: gem pristine yajl-ruby --version 1.4.1
Ignoring RedCloth-4.3.2 because its extensions are not built.  Try: gem pristine RedCloth --version 4.3.2
Ignoring bluecloth-2.2.0 because its extensions are not built.  Try: gem pristine bluecloth --version 2.2.0
Ignoring commonmarker-0.20.2 because its extensions are not built.  Try: gem pristine commonmarker --version 0.20.2
Ignoring eventmachine-1.2.7 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.7
Ignoring ffi-1.13.1 because its extensions are not built.  Try: gem pristine ffi --version 1.13.1
Ignoring ffi-1.12.2 because its extensions are not built.  Try: gem pristine ffi --version 1.12.2
Ignoring http-parser-1.2.2 because its extensions are not built.  Try: gem pristine http-parser --version 1.2.2
Ignoring http_parser.rb-0.6.0 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.6.0
Ignoring kgio-2.11.3 because its extensions are not built.  Try: gem pristine kgio --version 2.11.3
Ignoring nio4r-2.5.4 because its extensions are not built.  Try: gem pristine nio4r --version 2.5.4
Ignoring nio4r-2.5.2 because its extensions are not built.  Try: gem pristine nio4r --version 2.5.2
Ignoring nokogiri-1.10.10 because its extensions are not built.  Try: gem pristine nokogiri --version 1.10.10
Ignoring puma-5.1.0 because its extensions are not built.  Try: gem pristine puma --version 5.1.0
Ignoring puma-4.3.5 because its extensions are not built.  Try: gem pristine puma --version 4.3.5
Ignoring puma-3.12.6 because its extensions are not built.  Try: gem pristine puma --version 3.12.6
Ignoring puma-3.12.0 because its extensions are not built.  Try: gem pristine puma --version 3.12.0
Ignoring raindrops-0.19.1 because its extensions are not built.  Try: gem pristine raindrops --version 0.19.1
Ignoring rdiscount-2.2.0.2 because its extensions are not built.  Try: gem pristine rdiscount --version 2.2.0.2
Ignoring redcarpet-3.5.0 because its extensions are not built.  Try: gem pristine redcarpet --version 3.5.0
Ignoring therubyracer-0.12.3 because its extensions are not built.  Try: gem pristine therubyracer --version 0.12.3
Ignoring unf_ext-0.0.7.7 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.7
Ignoring unicorn-5.7.0 because its extensions are not built.  Try: gem pristine unicorn --version 5.7.0
Ignoring websocket-driver-0.7.3 because its extensions are not built.  Try: gem pristine websocket-driver --version 0.7.3
Ignoring yajl-ruby-1.4.1 because its extensions are not built.  Try: gem pristine yajl-ruby --version 1.4.1

## System

    Darwin foo 18.7.0 Darwin Kernel Version 18.7.0: Fri Oct 30 12:37:06 PDT 2020; root:xnu-4903.278.44.0.2~1/RELEASE_X86_64 x86_64
    GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) [/bin/bash]
    tmux 3.1b [/usr/local/bin/tmux]
    zsh 5.3 (x86_64-apple-darwin18.0) [/bin/zsh]
    ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18] [/Users/dentarg/.rubies/ruby-2.7.1/bin/ruby]
    Bundler version 2.1.4 [/Users/dentarg/.gem/ruby/2.7.1/bin/bundle]
    chruby version 0.3.9 [/usr/local/bin/chruby-exec]

## Environment

    CHRUBY_VERSION=0.3.9
    SHELL=/bin/zsh
    PATH=/Users/dentarg/.gem/ruby/2.7.1/bin:/Users/dentarg/.rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/bin:/Users/dentarg/.rubies/ruby-2.7.1/bin:/usr/local/opt/curl-openssl/bin:/usr/local/opt/postgresql@11/bin:/usr/local/bin:/usr/local/sbin:/usr/local/libexec:/Users/dentarg/Library/Python/3.8/bin:/usr/local/opt/curl/bin:/Users/dentarg/bin:/Users/dentarg/.cargo/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/npm/bin:/usr/local/opt/go/libexec/bin:/Users/dentarg/go/bin:/usr/X11R6/bin
    HOME=/Users/dentarg
    RUBIES=(/Users/dentarg/.rubies/ruby-2.4.10 /Users/dentarg/.rubies/ruby-2.4.3 /Users/dentarg/.rubies/ruby-2.4.9 /Users/dentarg/.rubies/ruby-2.5.7 /Users/dentarg/.rubies/ruby-2.5.8 /Users/dentarg/.rubies/ruby-2.6.5 /Users/dentarg/.rubies/ruby-2.6.6 /Users/dentarg/.rubies/ruby-2.7.0 /Users/dentarg/.rubies/ruby-2.7.1 /Users/dentarg/.rubies/ruby-2.7.2 /Users/dentarg/.rubies/ruby-3.0.0-preview1)
    RUBY_ROOT=/Users/dentarg/.rubies/ruby-2.7.1
    RUBY_VERSION=2.7.1
    RUBY_ENGINE=ruby
    RUBY_AUTO_VERSION=2.7.1
    RUBYLIB=
    RUBYOPT=
    RUBYPATH=
    RUBYSHELL=
    GEM_ROOT=/Users/dentarg/.rubies/ruby-2.7.1/lib/ruby/gems/2.7.0
    GEM_HOME=/Users/dentarg/.gem/ruby/2.7.1
    GEM_PATH=/Users/dentarg/.gem/ruby/2.7.1:/Users/dentarg/.rubies/ruby-2.7.1/lib/ruby/gems/2.7.0

## Hooks

    preexec_functions=(chruby_auto prompt_pure_preexec _zsh_highlight_preexec_hook)
    precmd_functions=(prompt_pure_precmd _zsh_highlight_main__precmd_hook)

I saw https://github.com/postmodern/chruby/issues/332 which also mentions gem pristine, but it seems to reproduce without JRuby (I had one JRuby version installed, but I did mv ~/.rubies/jruby-9.2.11.1 ~/Downloads; mv ~/.gem/jruby ~/Downloads before running the script above).

postmodern commented 3 years ago

I am guessing this is coming from chruby_auto when a .ruby-version file is encountered and chruby_use invokes the bin/ruby. I am curious when these gems were installed. What does head -n1 $(which puma) return? If it differs from which ruby then it's a GEM_HOME sharing issue which #419 addresses; and has already been merged into the 1.0.0 branch.

dentarg commented 3 years ago
$ head -n1 $(which puma)
#!/usr/bin/env ruby

$ which ruby
/Users/dentarg/.rubies/ruby-2.7.1/bin/ruby

Ah, I see... so it comes from the code at https://github.com/postmodern/chruby/blob/v0.3.9/share/chruby/chruby.sh#L45-L49. I see the extensions are not built messages when running /usr/bin/ruby -rrubygems -e '' (but not as many as above).

postmodern commented 3 years ago

and what is the output of tree "$GEM_HOME/extensions"? I'm curious why ruby is complaining the extensions were not built, despite the gems being in ~/.gem/ruby/2.7.1.

dentarg commented 3 years ago
$ tree "$GEM_HOME/extensions"
/Users/dentarg/.gem/ruby/2.7.1/extensions
└── x86_64-darwin-18
    └── 2.7.0-static
        ├── RedCloth-4.3.2
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── redcloth_scan.bundle
        ├── bluecloth-2.2.0
        │   ├── bluecloth_ext.bundle
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── mkmf.log
        ├── commonmarker-0.20.2
        │   ├── commonmarker
        │   │   └── commonmarker.bundle
        │   ├── gem.build_complete
        │   └── gem_make.out
        ├── eventmachine-1.2.7
        │   ├── fastfilereaderext.bundle
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── rubyeventmachine.bundle
        ├── ffi-1.12.2
        │   ├── ffi_c.bundle
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── mkmf.log
        ├── ffi-1.13.1
        │   ├── ffi_c.bundle
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── mkmf.log
        ├── http-parser-1.2.2
        │   ├── gem.build_complete
        │   └── gem_make.out
        ├── http_parser.rb-0.6.0
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── ruby_http_parser.bundle
        ├── kgio-2.11.3
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── kgio_ext.bundle
        │   └── mkmf.log
        ├── nio4r-2.5.2
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── nio4r_ext.bundle
        ├── nio4r-2.5.4
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── nio4r_ext.bundle
        ├── nokogiri-1.10.10
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── nokogiri
        │       └── nokogiri.bundle
        ├── puma-3.12.0
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── puma
        │       └── puma_http11.bundle
        ├── puma-3.12.6
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── puma
        │       └── puma_http11.bundle
        ├── puma-4.3.5
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── puma
        │       └── puma_http11.bundle
        ├── puma-5.1.0
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── puma
        │       └── puma_http11.bundle
        ├── raindrops-0.19.1
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── raindrops_ext.bundle
        ├── rdiscount-2.2.0.2
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── rdiscount.bundle
        ├── redcarpet-3.5.0
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── redcarpet.bundle
        ├── therubyracer-0.12.3
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── v8
        │       └── init.bundle
        ├── unf_ext-0.0.7.7
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── unf_ext.bundle
        ├── unicorn-5.7.0
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   ├── mkmf.log
        │   └── unicorn_http.bundle
        ├── websocket-driver-0.7.3
        │   ├── gem.build_complete
        │   ├── gem_make.out
        │   └── websocket_mask.bundle
        └── yajl-ruby-1.4.1
            ├── gem.build_complete
            ├── gem_make.out
            └── yajl
                └── yajl.bundle

34 directories, 90 files
dentarg commented 3 years ago

I'm setting a default Ruby like the README suggests

$ cat ~/.ruby-version
2.7.1

If I remove this file, the Ignoring ... because its extensions are not built messages are not shown when starting tmux or running the bug report script.

eregon commented 3 years ago

@dentarg Could you show ruby -e 'p RbConfig::CONFIG["ENABLE_SHARED"]'? Maybe it's caused by having installed a static-libruby (ENABLE_SHARED=no) Ruby 2.7.1 before, and the 2.7.1 Ruby being selected is a dynamic-libruby (ENABLE_SHARED=yes).

419 might solve it if these 2 Rubies have different basenames in your Rubies dir(s) (e.g. ~/.rubies/ruby-2.7.1 and ~/.rubies/ruby-2.7.1-static), https://github.com/postmodern/chruby/pull/431 would solve it reliably in all cases (unless you reinstall over an existing Ruby installation and don't rm -rf it first, ruby-install/manual install don't rm -rf automatically in such a case, ruby-build does).

dentarg commented 3 years ago

@eregon

$ ruby -e 'p RbConfig::CONFIG["ENABLE_SHARED"]'
"no"

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]

$ which ruby
/Users/dentarg/.rubies/ruby-2.7.1/bin/ruby