gsamokovarov / skiptrace

Bindings for your Ruby exceptions
MIT License
18 stars 5 forks source link

bindex (0.8.1) fails during bundle install Windows 10 x64 #8

Open pragadeesh2050 opened 4 years ago

pragadeesh2050 commented 4 years ago

I am unable to bundle install. See my below gem file

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.7'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

I get the below error in my console

Fetching bindex 0.8.1 Installing bindex 0.8.1 with native extensions C:/jruby-9.2.11.0/lib/ruby/stdlib/rubygems/ext/builder.rb:76: warning: unsupported popen option: err Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: C:/jruby-9.2.11.0/lib/ruby/gems/shared/gems/bindex-0.8.1/ext/skiptrace C:/jruby-9.2.11.0/bin/jruby.exe -I C:/jruby-9.2.11.0/lib/ruby/stdlib -r ./siteconf20200317-12972-weoypc.rb extconf.rb

current directory: C:/jruby-9.2.11.0/lib/ruby/gems/shared/gems/bindex-0.8.1/ext/skiptrace make "DESTDIR=" clean current directory: C:/jruby-9.2.11.0/lib/ruby/gems/shared/gems/bindex-0.8.1/ext/skiptrace make "DESTDIR=" make failedCannot run program "make" (in directory "C:\jruby-9.2.11.0\lib\ruby\gems\shared\gems\bindex-0.8.1\ext\skiptrace"): CreateProcess error=2, The system cannot find the file specified

Gem files will remain installed in C:/jruby-9.2.11.0/lib/ruby/gems/shared/gems/bindex-0.8.1 for inspection. Results logged to C:/jruby-9.2.11.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.5.0/bindex-0.8.1/gem_make.out

An error occurred while installing bindex (0.8.1), and Bundler cannot continue. Make sure that gem install bindex -v '0.8.1' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: web-console was resolved to 4.0.1, which depends on bindex

gsamokovarov commented 4 years ago

You are actually using JRuby on Windows here, right?

pragadeesh2050 commented 4 years ago

Yes jruby-9.2.11.0

You are actually using JRuby on Windows here, right?

Loffis commented 4 years ago

I'm experiencing exactly the same. Win 10.

gsamokovarov commented 4 years ago

Are you on JRuby as well?

Loffis commented 4 years ago

@gsamokovarov Yeah. Dropped it. Now running Ruby 2.6.6p146 and it works great.

headius commented 4 years ago

@gsamokovarov Can we get this fixed? I think the problem is that it's getting the platform mixed up when it's JRuby + Windows and not building properly.

JRuby gems almost never do extension builds because there's no need, and because many Java installs do not ship with javac. I can help you set up a -java gem that ships a pre-built JRuby extension, or we can find some other option. This is being reported to us as well: https://github.com/jruby/jruby/issues/6291

gsamokovarov commented 4 years ago

I'm in a remote location and downloading a Windows 10 virtual machine image is not an option for me at the moment. The solution is to release gems called bindex-java and skiptrace-java with the prebuilt JARs, right? I'm open to this.

belgoros commented 4 years ago

As @headius mentioned in the issue I opened earlier, here are some traces on a new Windows PC, no other Ruby installed:

- Windows 1O Professional
- 64 bits

Steps to follow:

It raises the error:

C:/jruby-9.2.12.0/bin/jruby.exe -I C:/jruby-9.2.12.0/lib/ruby/stdlib -r ./siteconf20200718-3884-1ddzkf4.rb extconf.rb

current directory: C:/jruby-9.2.12.0/lib/ruby/gems/shared/gems/bindex-0.8.1/ext/skiptrace
make "DESTDIR=" clean
current directory: C:/jruby-9.2.12.0/lib/ruby/gems/shared/gems/bindex-0.8.1/ext/skiptrace
make "DESTDIR="
make failedCannot run program "make" (in directory "C:\jruby-9.2.12.0\lib\ruby\gems\shared\gems\bindex-0.8.1\ext\skiptrace"): CreateProcess error=2, Le fichier spécifié est introuvable

Gem files will remain installed in C:/jruby-9.2.12.0/lib/ruby/gems/shared/gems/bindex-0.8.1 for inspection.
Results logged to C:/jruby-9.2.12.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.5.0/bindex-0.8.1/gem_make.out

C:\Users\Serge>jruby -v
jruby 9.2.12.0 (2.5.7) 2020-07-01 db01a49ba6 Java HotSpot(TM) 64-Bit Server VM 25.251-b08 on 1.8.0_251-b08 +jit [mswin32-x86_64]
deivid-rodriguez commented 1 week ago

@headius I just run into this and I'd say this is some Open3 issue on JRuby + Windows? Looking at the extension, I think it's supposed to do nothing on JRuby, but the problem seems to be that JRuby on Windows fails to run make?

deivid-rodriguez commented 1 week ago

Nevermind, as the error message actually suggess, I did not have make installed 🙈. @belgoros I was able to fix the error running winget install --source winget ezwinports.make seems to have fixed the issue for me.

headius commented 1 week ago

Yeah JRuby generally doesn't need make for JRuby extensions, and our installers and packages for Windows only need a JVM installed, so extensions that require building will have to get make some other way. I am guessing that some of the Windows packages for CRuby also include make and appropriate compiler stuff.

We could consider doing that, but I'm reluctant to add that to our packages.

@belgoros Your issue should be fixed by installing a compiler toolkit that includes make. This illustrates the problem I've tried to explain in https://github.com/rubygems/rubygems/issues/3520.

@deivid-rodriguez that issue is closed but remains a problem... even though nothing gets built, gems complain they need to be built when switching JDK version.

Other related issues:

The bottom line issue is that extension gems that support JRuby and don't want to ship a separate -java platform gem must stub out their makefile, but that means they still need make present and will complain if switching JDK version (because RubyGems' "already built" logic is specific to each JDK version even though nothing actually gets built).

deivid-rodriguez commented 1 week ago

Cool.

Yeah, the use case explained in https://github.com/rubygems/rubygems/pull/7372 seems valid, I'm happy to try making it easier to optionally avoid running make at all. That PR proposes a more explicit approach, but more complicated to rollout. I personally think detecting empty Makefiles is easy enough and will fix most issues.