Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native gem installation doesn't work on Windows with >= 2.4.0 #977

Closed
blt04 opened this issue Jul 18, 2014 · 88 comments
Closed

Native gem installation doesn't work on Windows with >= 2.4.0 #977

blt04 opened this issue Jul 18, 2014 · 88 comments

Comments

@blt04
Copy link

blt04 commented Jul 18, 2014

Trying to install a native gem on Windows doesn't work with RubyGems >= 2.4.0, Ruby 1.9.3-p547. DevKit is installed. As far as I can tell, this is related to b97ec2a

C:\ruby-1.9.3-p547\bin> gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    C:/ruby-1.9.3-p547/bin/ruby.exe -r ./siteconf20140718-2252-edb699.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/ruby-1.9.3-p547/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/ruby-1.9.3-p547/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/json-1.8.1/gem_make.out

If you look at the Makefile, you see:

DESTDIR = C:
sitelibdir = $(DESTDIR)./.gem.20140718-2252-16mglgm
sitearchdir = $(DESTDIR)./.gem.20140718-2252-16mglgm

With rubygems < 2.4, the Makefile would look like:

DESTDIR = C:
sitelibdir = $(DESTDIR)/ruby-1.9.3-p547/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/.gem.20140718-3932-p1yu3u
sitearchdir = $(DESTDIR)/ruby-1.9.3-p547/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/.gem.20140718-3932-p1yu3u
@holtrop
Copy link

holtrop commented Jul 18, 2014

I'm seeing this as well with Rubygems 2.4.1, ruby 1.9.3p545 (2014-02-24) [i386-mingw32].

@drbrain drbrain added this to the 2.5 milestone Jul 20, 2014
@drbrain
Copy link
Member

drbrain commented Jul 20, 2014

It looks like @b97ec2a will only work on Ruby 2.0.0 and newer so I will update it to not apply to early ruby.

@hehahovip
Copy link

Got the same error, in Rubygems 2.4.1, ruby 1.9.3p545 (2014-02-24) [i386-mingw32].
C:\Ruby193>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/Ruby193/bin/ruby.exe -r ./siteconf20140728-2956-j82opf.rb extconf.rb
creating Makefile

make clean
Makefile:165: *** target pattern contains no `%'. Stop.

make
Makefile:165: *** target pattern contains no `%'. Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.
1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/js
on-1.8.1/gem_make.out

C:\Ruby193>ruby -v
ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

C:\Ruby193>gem --version
2.4.1

@ghost
Copy link

ghost commented Aug 9, 2014

Same issue as above.

gem install json
Fetching: json-1.8.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe -r ./siteconf20140809-24288-wfgqsd.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/json-1.8.1/gem_make.out

C:\Users\pduncan\jekapp>ruby -v
ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

C:\Users\pduncan\jekapp>gem --version
2.4.1

@luislavena
Copy link
Member

@hehahovip @petedunc88 there is a issue with newer RubyGems and Ruby 1.9.3.

Until that is fixed, please revert to older version of RubyGems.

@ealexhaywood
Copy link

I am having the same exact error, except with executing

gem install debugger

RubyGems 2.4.1 & Ruby 1.9.3-p429 w/ DevKit installed.

@ishristov
Copy link

Is there any progress on this? I am getting the same error.

@ealexhaywood
Copy link

No. I eventually switched over to Ubuntu Linux OS and my issue has been resolved

On Aug 19, 2014, at 4:54 AM, ishristov notifications@github.com wrote:

Is there any progress on this? I am getting the same error.


Reply to this email directly or view it on GitHub.

@luislavena
Copy link
Member

@ishristov as commented before and also on RubyInstaller mailing list, if you're using Ruby 1.9.3, please downgrade to 1.8.29:

https://groups.google.com/d/topic/rubyinstaller/k19SeJijpKU/discussion

@XhmikosR
Copy link

XhmikosR commented Sep 5, 2014

I guess gem update --system 2.3.0 is an acceptable workaround until this issue is sorted.

@net1957
Copy link

net1957 commented Sep 10, 2014

I confirm that gem update --system 2.3.0 is working (windows 8.1 x64) but 2.4.0 and 2.4.1 fails
(ruby 1.9.3p545 (2014-02-24) [i386-mingw32])

@vaibhavatul47
Copy link

gem update --system 2.3.0
this command removed error failed to build gem native extension. thanks.

@net1957
Copy link

net1957 commented Oct 2, 2014

Not corrected in 2.4.2

@XhmikosR
Copy link

XhmikosR commented Oct 2, 2014

Yeah. I still have to use the solution I mention a few posts above.
On Oct 2, 2014 9:27 PM, "net1957" notifications@github.com wrote:

Not corrected in 2.4.2


Reply to this email directly or view it on GitHub
#977 (comment).

@drbrain
Copy link
Member

drbrain commented Oct 2, 2014

Nope, its still open, I haven't had time to fix it yet.

@akshathamk
Copy link

gem update --system 2.3.0 worked for me too. Had to downgrade it from 2.4.1.

@acharyaankush
Copy link

Downgrading to gem 2.3.0 worked. Thanks a lot!

@vishalm
Copy link

vishalm commented Oct 20, 2014

I was working on APPIUM and thanks Downgrading to gem 2.3.0 worked. Thanks a lot!

@markdav
Copy link

markdav commented Nov 22, 2014

Thanks folks, downgrading worked for me too.

@psudarshan
Copy link

Thanks a lot!! I have been searching for this solution for long time, was not able to use debugger with rubymine. Downgrading to gem 2.3.0 worked.

@egad1868
Copy link

Worked for me! Thanks! Spent the last 2 days trying to get this to work !@#!

@sahilsk
Copy link

sahilsk commented Jan 3, 2015

thanks. It helped in installing mongoid for me.
(bson gem was stopping me from moving forward)

@mrthan
Copy link

mrthan commented Jan 8, 2015

I'm still getting this issue in 2.4.5 - reverting to 2.3.0 fixed it thankfully. Almost lost it..

also, I did get this https issue which lead me to running gem --update-system

@indirect
Copy link
Member

@duckinator awesome, thanks for figuring this out!

It seems like applying your suggested change would result in 1.9.3 acting the same way as it did before commit b97ec2a, and 2.0.0 acting the same way as it does after b97ec2a. I'm satisfied with that solution, since nothing is worse than it was before. Let's make that change and release a new 2.5.x version with the fix. That way everyone can simply run gem update --system to get the fix.

Everyone who has participated in this ticket, please consider upgrading to a newer version of Ruby. Ruby 1.9 no longer gets patches of any kind, even security updates, and Ruby 2.0 will only get security fixes until Feb. 24, 2016, when Ruby 2.1 will be moved to security-only fixes. If you want (or need) actual bugfixes in Ruby, please upgrade to Ruby 2.2 or 2.3.

@duckinator
Copy link
Member

Pull request #1453 should resolve this, with the caveat that if you are using Ruby 1.9 on Windows and mktmpdir returns a path with a space, it will fail.

copiousfreetime pushed a commit to copiousfreetime/rubygems that referenced this issue Jan 31, 2016
copiousfreetime pushed a commit to copiousfreetime/rubygems that referenced this issue Feb 5, 2016
@venus342
Copy link

Same issue. Switched to Kali Linux and it fixed my problem

@Skarlso
Copy link

Skarlso commented Jul 21, 2016

@duckinator OSX also suffers from this... :/

@duckinator
Copy link
Member

What does gem --version say? If it reports a version before 2.5.2, please try updating to the latest version of RubyGems (by running gem update --system) and let me know if that fixes it.

@Skarlso
Copy link

Skarlso commented Jul 22, 2016

@duckinator I was using the latest. 2.6.x. I also tried to revert to using gem update --system 2.3.0 but with the same result. :/ it's not a big deal actually, because the project I'm working on just declared 1.9.x EOL. :) Which, I think is a very good move.

@Ingosmar89219
Copy link

C:\Windows\system32>gem update --system 2.3.0
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://rubygems.org/specs.4.8.gz)

please help me im using windows 8.1

milendd added a commit to milendd/ruby-retrospective-2016 that referenced this issue Jan 12, 2017
Could not install rainbow 2.2.1 on Windows 7.
Tried to fix it using DevKit.

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#building-the-devkit
After following the instructions, still not worked.
Native gem installation doesn't work on Windows issue.
rubygems/rubygems#977
And finally make it work.
@aaroncalderon
Copy link

Hi,

I am still experiencing this same issue on an fresh install of ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] Windows 10. trying to install gem install jekyll

Any suggestions?

@MSP-Greg
Copy link
Contributor

@aaroncalderon

This issue started with Ruby 1.9.3. Please post more info. I am familiar with newer Ruby versions on Windows...

@aaroncalderon
Copy link

@MSP-Greg I am trying to install Jekyll. I already installed bundler. But, when I try to install Jekyll, I get errors.

I have tryed to downgrade to gem update --system 2.3.0 but when I do, I get other errors. I think, that is because I have the DevKit for ruby 2.5 installed.

Ruby Info

ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]

Installing Jekyll

I run:

gem install jekyll

I get:

Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20180818-15452-acpiuw.rb extconf.rb
creating Makefile

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.

make failed, exit code 1

Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/http_parser.rb-0.6.0/gem_make.out

@MSP-Greg
Copy link
Contributor

@aaroncalderon

The issue is building the gem http_parser.rb. What's the output from ridk version?

@aaroncalderon
Copy link

@MSP-Greg

 ridk version
---
ruby:
  path: C:/Ruby25-x64
  version: 2.5.1
  platform: x64-mingw32
ruby_installer:
  package_version: 2.5.1-2
  git_commit: 1dfa3f5
msys2:
  path: C:\dev\prd\msys64
  title: MSYS2 64bit
  version: '20180531'
sh: GNU bash, version 4.4.19(3)-release (x86_64-pc-msys)
os: Microsoft Windows [Version 10.0.16299.611]

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Aug 18, 2018

@aaroncalderon

I haven't looked at the ridk code for a while, but same install on my system reports:

PS C:\Greg\GitHub> ridk version
---
ruby:
  path: C:/Greg/Ruby25-x64
  version: 2.5.1
  platform: x64-mingw32
ruby_installer:
  package_version: 2.5.1-1
  git_commit: 71c9f4e
msys2:
  path: C:\Greg\msys64
  title: MSYS2 64bit
  version: '20180531'
cc: x86_64-w64-mingw32-gcc (Rev1, Built by MSYS2 project) 8.2.0
sh: GNU bash, version 4.4.19(3)-release (x86_64-pc-msys)
os: Microsoft Windows [Version 10.0.17134.228]

It looks like your MSYS2/MinGW install is incomplete. Maybe something like:

ridk exec pacman -Sy --needed base-devel mingw-w64-x86_64-toolchain

@aaroncalderon
Copy link

@MSP-Greg

You are right. I will have to configure pacman to trust a custom certificate to allow it to connect and download the packages.

I get the following message when I run the command that you suggested.

SSL certificate problem: self signed certificate in certificate chain

Will you have an idea of how to do that?

I had to do the same for npm, Vagrant, Ruby, git, wget...

Each software has it's own peculiar way to get them configured,

e.g. wget: https://stackoverflow.com/questions/22282013/how-to-use-wget-with-ssl-certificate/50494174#50494174

@MSP-Greg
Copy link
Contributor

I work quite a bit with OpenSSL (I'm trying to build Ruby trunk with openssl/openssl master right now, works locally but not on Appveyor...)

I've never had an issue with Ruby or pacman. Any idea where the 'self signed cert' is?

What does ENV['SSL_CERT_FILE'] or echo %SSL_CERT_FILE% or echo $env:SSL_CERT_FILE show? I can't recall the name of it, but have you got that Windows OpenSSL package (Shining Light?) installed? If so, and if it's in your path, try removing it.

Otherwise, I'm not sure, but this isn't a RubyGems issue...

@aaroncalderon
Copy link

aaroncalderon commented Aug 19, 2018

@MSP-Greg

The self signed certificate recides at the corporate's proxy server 🙄.

On windows the environment variable SSL_CERT_FILE is not defined.

I will try to look into. So, I think you are right. It is not a ruby issue at this point.

Thanks so much.

I did had to configure ruby to use the self signed certificate.

I got the public certificate, I put it on the folder C:\Ruby25-x64\ssl\certs\ , then I executed the provided script c_rehash.rb and I was in business.

Now I have to iron out the pacman issue.

@tromlet
Copy link

tromlet commented May 29, 2019

I appear to get the same issue on Windows:

C:\Users\User>gem install av_capture
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing av_capture:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/av_capture-1.0.2/ext/av_capture
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190529-1428-gzweze.rb extconf.rb
creating Makefile

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/av_capture-1.0.2/ext/av_capture
make "DESTDIR=" clean

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/av_capture-1.0.2/ext/av_capture
make "DESTDIR="
generating av_capture-x64-mingw32.def
compiling connection.m
x86_64-w64-mingw32-gcc.exe: error: CreateProcess: No such file or directory
make: *** [Makefile:250: connection.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/av_capture-1.0.2 for inspection.
Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/av_capture-1.0.2/gem_make.out

@MSP-Greg
Copy link
Contributor

@tromlet

See https://github.com/tenderlove/av_capture

That gem is MacOS/OSX specific.

@tromlet
Copy link

tromlet commented May 30, 2019

Wow!

I... feel ridiculous. :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests