Receiving error on Windows machine when Installing linecache ERROR: Failed to build gem native extension on

情到浓时终转凉″ 提交于 2020-01-14 01:43:06

问题


When attempting to perform a bundle install of an existing Ruby on Rails project I receive an error when the bundler reaches Installing linecache (0.43) with native extensions. I don't see linecache in the projects Gem file so I can't try bundling without it. I'm running Windows 7 and JetBrains RubyMine 2.0.2. I have tried bundling from inside RubyMine and from the command line (I realize these are equivalent).

I have the following Ruby and DevKit-3.4.5-20100819-1535-sfx directories in my path:

C:\Ruby187\bin
C:\DevKit-3.4.5-20100819-1535-sfx\bin
C:\DevKit-3.4.5-20100819-1535-sfx\mingw\bin

Below is the output from the bundle command:

Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using activesupport (2.3.4) 
Using rack (1.0.1) 
Using actionpack (2.3.4) 
Using actionmailer (2.3.4) 
Using activerecord (2.3.4) 
Using activeresource (2.3.4) 
Using authlogic (2.1.6) 
Using builder (2.1.2) 
Using mime-types (1.16) 
Using xml-simple (1.0.12) 
Using aws-s3 (0.6.2) 
Using bundler (1.0.0) 
Using calendar_date_select (1.16.1) 
Using cgi_multipart_eof_fix (2.5.0) 
Using configuration (1.1.0) 
Using daemons (1.1.0) 
Using delayed_job (2.1.0.pre) 
Using factory_girl (1.3.2) 
Using gem_plugin (0.2.3) 
Using json_pure (1.4.6) 
Using launchy (0.3.7) 
Using rest-client (1.6.1) 
Using heroku (1.11.0)
Installing linecache (0.43) with native extensions C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

C:/Ruby187/bin/ruby.exe extconf.rb 
creating Makefile

make
Makefile:130: warning: overriding commands for target `C:/Code'
Makefile:124: warning: ignoring old commands for target `C:/Code'
gcc -I. -I/C/Ruby187/lib/ruby/1.8/i386-mingw32 -I/C/Ruby187/lib/ruby/1.8/i386-mingw32 -I.   -g -O2 -DFD_SETSIZE=256    -c trace_nums.c
gcc -shared -s -o trace_nums.so trace_nums.o -L. -LC:/Ruby187/lib -L.  -Wl,--enable-auto-image-base,--enable-auto-import,--export-all   -lmsvcrt-ruby18  -lshell32 -lws2_32  

make install
Makefile:130: warning: overriding commands for target `C:/Code'
Makefile:124: warning: ignoring old commands for target `C:/Code'
install -d C:/Code
/bin/install -c -m 0755 trace_nums.so C:/Code Metrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/linecache-0.43/lib
/bin/install: omitting directory `C:/Code'
make: *** [Metrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/linecache-0.43/lib/trace_nums.so] Error 1


Gem files will remain installed in C:/Code Metrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/linecache-0.43 for inspection.
Results logged to C:/Code Metrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/linecache-0.43/ext/gem_make.out
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each'
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `run'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `send'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
    from C:\Ruby187\bin/bundle:19:in `load'
    from C:\Ruby187\bin/bundle:19
    from -e:1:in `load'
    from -e:1

Process finished with exit code 1

What am I missing that is causing this bundle to fail?


回答1:


Looks like it may be because of the space in a ruby installation path "C:/Code Metrics/2nd/cmusv/autotest-growl/ruby/...":

Makefile:130: warning: overriding commands for target `C:/Code'

/bin/install: omitting directory `C:/Code'
make: *** [Metrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/linecache-0.43/lib/trace_nums.so] Error 1

Is RubyMine configured to use a different ruby installation? Does your PATH system var have this path listed and at a higher precedence than your Ruby187 install?



来源:https://stackoverflow.com/questions/4026096/receiving-error-on-windows-machine-when-installing-linecache-error-failed-to-bu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!