JetBrains / ruby-type-inference

Dynamic definitions and types provider for ruby static analysis
Apache License 2.0
137 stars 7 forks source link

arg_scanner 0.3.1 install fails #42

Closed psulightning closed 4 years ago

psulightning commented 4 years ago

Issue

arg_scanner gem not installed via ruby gems.

When attempting to use gem install to get arg_scanner on first pass:

$ gem install arg_scanner
Building native extensions. This could take a while...
ERROR:  Error installing arg_scanner:
    ERROR: Failed to build gem native extension.

    current directory: /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.1/ext/arg_scanner
/Users/zhamman/.rbenv/versions/2.6.5/bin/ruby -I /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191210-97696-s44q0s.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/zhamman/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
/Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- debase/ruby_core_source (LoadError)
    from /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from extconf.rb:5:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.1 for inspection.
Results logged to /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/arg_scanner-0.3.1/gem_make.out

Resolved by explicitly installing debase-ruby_core_source gem.

On second attempt, gem install errors with the following:

$ gem install arg_scanner
Building native extensions. This could take a while...
ERROR:  Error installing arg_scanner:
    ERROR: Failed to build gem native extension.

    current directory: /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.1/ext/arg_scanner
/Users/zhamman/.rbenv/versions/2.6.5/bin/ruby -I /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191210-98119-ilkjqd.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/zhamman/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
/Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- native-package-installer (LoadError)
    from /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from extconf.rb:6:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/arg_scanner-0.3.1 for inspection.
Results logged to /Users/zhamman/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/arg_scanner-0.3.1/gem_make.out

Again resolved by explicitly installing native-package-installer.

I noticed that the gemspec has these gems as development dependencies (https://github.com/JetBrains/ruby-type-inference/blob/master/arg_scanner/arg_scanner.gemspec#L36-L37); however, the extconf.rb requires them (https://github.com/JetBrains/ruby-type-inference/blob/master/arg_scanner/ext/arg_scanner/extconf.rb#L5-L6).

Recommendations

Three possible options present themselves to resolve this issue:

  1. Update gemspec to make debase-ruby_core_source and native-package-installer dependencies instead of development dependencies
  2. If said gems are not necessary, update extconf.rb to not require them.
  3. Update README.md to detail explicit install of necessary gems.

Environment

OS: Mojave IDE: RubyMine 2019.3 RubyGems Environment:

nikitabobko commented 4 years ago

Thank you! Fixed in 0.3.3 version