问题
i'm new to all of this but i get this error when i try to install http_parser using gem:
dongl_000@LENNY ~/ava-home (master)
$ gem install http_parser.rb -v '0.6.0'
Building native extensions. This could take a while...
ERROR: Error installing http_parser.rb:
ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160217-15056-1hoiyfc.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
make: *** No rule to make target '/c/Ruby22-x64/include/ruby-2.2.0/ruby.h', need
ed by 'ruby_http_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/http_p
arser.rb-0.6.0 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/http_parser.rb-0.6.0/gem_make.out
ruby version: 2.2.1
rubyGem version: 2.4.5
Thank you!
回答1:
I was going through this very same issue.
Looked up the Git Repository for the Gem (HTTP_Parser) and found out the reason for my problem:
HTTP_Parser currently doesn't not support a Path with spaces
So I renamed my path and solved it.
回答2:
Hopefully by now you've found the answer. However, for others (like me) who find this post, here's what's needed:
- Install Ruby+DevKit from RubyInstaller: https://rubyinstaller.org/downloads/
- Check the "ridk install" checkbox at the end of the installer.
- When RIDK runs, pick option 3 to install both MSYS and MINGW dev tools (
make
is provided with the MINGW stuff).
Open a fresh console (to get fresh environment variables), and rerun your gem or bundle command...and hope for the best.
Hope that helps!
来源:https://stackoverflow.com/questions/35469619/while-installing-http-parser-rb-error-failed-to-build-gem-native-extension