2012-12-28 153 views
3

當嘗試使用RVM安裝Ruby 1.9.3(RVM安裝Ruby 1.9.3)我得到以下錯誤:錯誤與RVM(OSX 10.8)安裝Ruby

Searching for binary rubies, this might take some time. 

No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p362. 
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. 

Fetching yaml-0.1.4.tar.gz to /Users/christiaan/.rvm/archives 
Extracting yaml to /Users/christiaan/.rvm/src/yaml-0.1.4 
Configuring yaml in /Users/christiaan/.rvm/src/yaml-0.1.4. 

Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/configure.log 

Compiling yaml in /Users/christiaan/.rvm/src/yaml-0.1.4. 

Error running 'make', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/make.log 
Installing Ruby from source to: /Users/christiaan/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection... 
ruby-1.9.3-p362 - #extracted to /Users/christiaan/.rvm/src/ruby-1.9.3-p362 (already extracted) 
ruby-1.9.3-p362 - #configuring 
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/configure.log 

There has been an error while running configure. Halting the installation. 

我已經嘗試了所有的技巧從類似的問題,但似乎無法解決這個問題。

YAML日誌(首先產生錯誤日誌):

[2012-12-28 16:18:06] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr 
current path: /Users/christiaan/.rvm/src/yaml-0.1.4 
command(4): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr 
checking for a BSD-compatible install... /usr/bin/install -c 
checking whether build environment is sane... yes 
checking for a thread-safe mkdir -p... config/install-sh -c -d 
checking for gawk... no 
checking for mawk... no 
checking for nawk... no 
checking for awk... awk 
checking whether make sets $(MAKE)... yes 
checking for gcc... /usr/local/bin/gcc-4.2 
checking whether the C compiler works... no 
configure: error: in `/Users/christiaan/.rvm/src/yaml-0.1.4': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 

RVM日誌(生產第二個錯誤日誌):

[2012-12-28 16:18:08] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr 
current path: /Users/christiaan/.rvm/src/ruby-1.9.3-p362 
command(7): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr 
checking build system type... x86_64-apple-darwin12.2.0 
checking host system type... x86_64-apple-darwin12.2.0 
checking target system type... x86_64-apple-darwin12.2.0 
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables 
See `config.log' for more details. 
+0

郵政錯誤日誌。 – Remear

+0

另外,發佈您正在使用的命令。 – Remear

+1

好的,我已經添加了它們。 – chendriksen

回答

9

你的主要問題是:

configure: error: C compiler cannot create executables 

所以搜索爲解決這個問題。像:

rvm install 1.9.3 --with-gcc=clang 

其他例子:

+0

我建議不要用鏗鏘編譯Ruby。它仍然不完全兼容,你的里程會有所不同。堅持用gcc。 '''rvm requirements'''告訴你用gcc設置你的環境的最簡單的方法。 – Remear

+0

@Remear好的..謝謝。我仍然感到奇怪,人們似乎一次又一次地偶然發現同樣的問題。他們是否閱讀說明書或「rvm要求」無法正常工作?奇怪..在任何情況下,這個特定的問題似乎是一個gcc(Xcode?)安裝問題。 – Casper

+0

RVM開發面臨的最大問題之一是缺乏以下指示。對於安裝大多數紅寶石所需做的事情,rvm要求一直是系統特定信息的事實標準。你只能做很多事情來獲取信息,但你不能讓人們真正閱讀它。不幸的是,很多博客都是人們去尋找解決方案的地方,他們中有很多錯誤信息。這個特殊的問題似乎是在用戶的$ PATH中缺乏合適的基於gcc的編譯器。 – Remear

3

Xcode->首選項

檢查 「命令行工具」

+0

是的,我已經安裝了。 – chendriksen