2015-06-03 173 views
2

我在Windows上,而且我現在有Ruby v2.1.5,因爲這是RailsInstaller的附帶。但是,我需要將其降級到另一個項目的2.1.1版本,而且我不知道如何去做。在Cygwin上用RVM安裝Ruby時遇到麻煩

我已經安裝在Cygwin RVM並試圖執行rvm install 2.1.1

Searching for binary rubies, this might take some time. 
No binary rubies available for: cygwin/unknown/x86_64/ruby-2.1.1. 
Continuing with compilation. Please read 'rvm help mount' to get more 
information on binary rubies. 

Checking requirements for cygwin. 
Installing requirements for cygwin. 
Updating system. 
Installing required packages: mingw64-i686-gcc, mingw64-x86_64-gcc. 
Requirements installation successful. 
Installing Ruby from source to: /home/K/.rvm/rubies/ruby-2.1.1, this may take a while depending on your cpu(s)... 
ruby-2.1.1 - #downloading ruby-2.1.1, this may take a while depending on your connection... 
ruby-2.1.1 - #extracting ruby-2.1.1 to /home/K/.rvm/src/ruby-2.1.1.... 
ruby-2.1.1 - #applying patch /home/K/.rvm/patches/ruby/2.1.1/libyaml.patch. 
ruby-2.1.1 - #applying patch /home/K/.rvm/patches/ruby/changeset_r45225.diff. 
ruby-2.1.1 - #applying patch /home/K/.rvm/patches/ruby/changeset_r45240.diff. 
ruby-2.1.1 - #configuring.................................................... 
ruby-2.1.1 - #post-configuration.. 
ruby-2.1.1 - #compiling.................................................... 
Error running '__rvm_make -j4', 
showing last 15 lines of /home/K/.rvm/log/1433355357_ruby-2.1.1/make.log 
make[2]: Leaving directory '/home/K/.rvm/src/ruby-2.1.1/ext/-test-/printf' 
exts.mk:109: recipe for target 'ext/-test-/printf/all' failed 
make[1]: *** [ext/-test-/printf/all] Error 2 
make[1]: *** Waiting for unfinished jobs.... 
installing default rational libraries 
installing default recursion libraries 
make[2]: Leaving directory '/home/K/.rvm/src/ruby-2.1.1/ext/-test-/postponed_job' 
linking shared-object -test-/rational.so 
linking shared-object -test-/recursion.so 
make[2]: Leaving directory '/home/K/.rvm/src/ruby-2.1.1/ext/-test-/recursion' 
make[2]: Leaving directory '/home/K/.rvm/src/ruby-2.1.1/ext/-test-/rational' 
make[1]: Leaving directory '/home/K/.rvm/src/ruby-2.1.1' 
uncommon.mk:180: recipe for target 'build-ext' failed 
make: *** [build-ext] Error 2 
++ return 2 
There has been an error while running make. Halting the installation. 

任何幫助時,將不勝感激我得到了這些問題。謝謝

回答

0

您需要修補ruby soure代碼,以便它可以在cygwin上編譯。值得慶幸的是rvm支持開箱即用!

創建一個名爲cygwin.patch文件,內容如下:

--- /ext/-test-/printf/printf.c 2014-06-29 10:17:20.000000000 -0700 
+++ /ext/-test-/printf/printf.c 2015-07-08 16:58:15.882479100 -0700 
@@ -1,3 +1,4 @@ 
+#define __STRICT_ANSI__ /* avoid conflicting utoa */ 
#include <ruby.h> 
#include <ruby/encoding.h> 

而現在只要用--patch參數如下圖所示執行rvm

rvm install 2.2-head --patch cygwin.patch

+0

並沒有爲我工作>< – bkunzi01