2013-02-12 102 views
4

這是我第一次使用Ruby。我意識到不要使用sudo來安裝Gems,所以我遵循這個tutotrial(http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac)來安裝RVM,以便我可以更新我的Ruby版本,然後安裝Middleman(http://middlemanapp.com/)。在OS X上通過RVM安裝Ruby時運行'make'時出錯Mountain Lion

RVM安裝工作,但在「#compiling」階段,我得到以下錯誤安裝Ruby 1.9.3時:

Error running 'make', please read /Users/Mark/.rvm/log/ruby-1.9.3-p385/make.log There has been an error while running make. Halting the installation.

我打開日誌文件,不像很多的我已經等問題可以看到,該文件不包含對'readline'的引用,而是對'編譯',我假定它涉及到Ruby安裝的'#compiling'階段。下面是輸出到make.log裏:

[2013-02-12 09:04:26] make 
    CC = clang 
    LD = ld 
    LDSHARED = clang -dynamic -bundle 
    CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -pipe 
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT 
    CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/Mark/.rvm/usr/include -I. -I.ext/include/x86_64-darwin12.2.0 -I./include -I. 
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace 
    SOLIBS = 
compiling main.c 
compiling dmydln.c 
compiling dmyencoding.c 
compiling version.c 
compiling dmyversion.c 
compiling miniprelude.c 
compiling array.c 
compiling bignum.c 
bignum.c:2732:26: warning: while loop has empty body [-Wempty-body] 
     while (--ny && !zds[ny]); ++ny; 
           ^
bignum.c:2732:26: note: put the semicolon on a separate line to silence this warning 
1 warning generated. 
compiling class.c 
compiling compar.c 
compiling complex.c 
compiling dir.c 
compiling dln_find.c 
compiling enum.c 
compiling enumerator.c 
compiling error.c 
compiling eval.c 
compiling load.c 
compiling proc.c 
compiling file.c 
compiling gc.c 
gc.c:3060:1: warning: unused function 'chain_finalized_object' [-Wunused-function] 
chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg) 
^ 
1 warning generated. 
compiling hash.c 
compiling inits.c 
compiling io.c 
compiling marshal.c 
compiling math.c 
compiling node.c 
compiling numeric.c 
compiling object.c 
compiling pack.c 
compiling parse.c 
compiling process.c 
compiling random.c 
compiling range.c 
compiling rational.c 
compiling re.c 
compiling regcomp.c 
compiling regenc.c 
compiling regerror.c 
compiling regexec.c 
compiling regparse.c 
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32] 
    return t->num_entries; 
    ~~~~~~ ~~~^~~~~~~~~~~ 
1 error generated. 
make: *** [regparse.o] Error 1 

如果我執行「make --version」我得到以下輸出:

GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

我在努力尋找精確匹配的問題,所以如果任何人都能幫上忙,那會很棒。

乾杯,

馬克。

+1

你好馬克,嘗試一個乾淨的安裝,看看是否重現錯誤。你可以使用[Rails Installer](http://railsinstaller.org/#osx)。它也基於RVM。的 – 2013-02-12 09:48:06

+0

可能重複[無法編譯紅寶石1.9.3(http://stackoverflow.com/questions/14592945/cannot-compile-ruby-1-9-3) – mpapis 2013-02-12 14:57:30

回答

3

我跟着一些建議在這裏和鏈接和其他職位谷歌搜索,但最終,通過自制軟件更新GCC是什麼終於拿到了Ruby的安裝請編譯,完整。

具體的鏈接我用於更新GCC:Installing Ruby on Mac OS X 10.8.2

所以感謝所有幫助,我不能肯定,如果它是所有的更新和清理,以及GCC或只是GCC的組合,但我正在運行。

+1

超級用戶上的這個答案涉及通過自制軟件更新GCC,併爲我工作:http://superuser.com/a/546778 – 2013-02-19 01:35:08

+0

@KevinC。是的,就是這樣。感謝您的鏈接。 – 2013-02-19 09:26:58

1

雖然你沒有看到它實際上是造成了Readline的錯誤。正如atmosx所說,我會刪除默認的MAC OS X安裝的ruby,並從一開始就遵循這個過程。

或之後這個https://rvm.io/packages/readline/幫助解決的ReadLine。也可對照看一下這個前面的問題:Error running make when installing Ruby 1.8.7-p302 via RVM on Mac OS 10.5.8

So complete steps are:

rvm pkg install readline 
rvm remove 1.8.7 
rvm cleanup all 
rvm install 1.8.7 -C –with-readline-dir=$rvm_path/usr 

感謝Andrew在http://anlek.com/2011/01/rvm-install-1-8-7-p330-fails/的指針。

+0

我不認爲你值得向下票那裏!我在其他方面跟隨了這一點,並設法讓Ruby安裝並運行。 – 2013-02-18 13:23:25

相關問題