2013-08-24 101 views
7

在Macbook Pro上使用OSX 10.8.4,包括自制軟件,xcode(帶命令行工具)和libffi。無法通過rvm bundle install安裝ffi 1.9.0 - OSX 10.8.4

我已經安裝了rvm和ruby-1.9.3-p448並且有一個名爲omega.ecoop的gemset。有一個gemfile列出了這個項目所需的寶石。但是,在運行捆綁檢查後,我無法安裝它們:

Bundler can't satisfy your Gemfile's dependencies. 

這是正確的,因爲它們未安裝。於是我就用:

bundle install 

產生如下:

Sams-MacBook-Pro:ecoop Sam$ bundle install 
Fetching gem metadata from https://rubygems.org/.......... 
Fetching gem metadata from https://rubygems.org/.. 
Resolving dependencies... 
Using addressable (2.3.5) 
Using chunky_png (1.2.8) 
Using fssm (0.2.10) 
Using sass (3.2.10) 
Using compass (0.12.2) 
Using breakpoint (2.0.6) 
Using coderay (1.0.9) 
Using compass-blend-modes (0.0.2) 
Using color-schemer (0.2.5) 
Using compass-normalize (1.4.3) 
Using compass-rgbapng (0.2.1) 
Using compass-validator (3.0.1) 
Using css_parser (1.3.5) 
Using eventmachine (1.0.3) 
Using http_parser.rb (0.5.3) 
Using em-websocket (0.5.0) 
Installing ffi (1.9.0) 

一切正常,直到:

Installing ffi (1.9.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /Users/Sam/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
checking for ffi.h... no 
checking for ffi.h in /usr/local/include,/usr/include/ffi... no 
checking for rb_thread_blocking_region()... yes 
checking for rb_thread_call_with_gvl()... yes 
checking for rb_thread_call_without_gvl()... yes 
checking for ffi_prep_cif_var()... no 
creating extconf.h 
creating Makefile 

make 
mkdir -p "/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64; (if [ ! -f "/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64/Makefile ]; then echo "Configuring libffi for x86_64"; cd "/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64 && env CC=" gcc-4.6" CFLAGS="-arch x86_64 " LDFLAGS="-arch x86_64" "/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=x86_64-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64 
Configuring libffi for x86_64 
configure: WARNING: if you wanted to set the --build type, don't use --host. 
    If a cross compiler is detected then cross compile mode will be used 
configure: error: in `/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c/libffi-x86_64': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 
make[1]: *** No targets specified and no makefile found. Stop. 
make: *** ["/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64/.libs/libffi_convenience.a] Error 2 


Gem files will remain installed in /Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0 for inspection. 
Results logged to /Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.9.0/ext/ffi_c/gem_make.out 

An error occurred while installing ffi (1.9.0), and Bundler cannot continue. 
Make sure that `gem install ffi -v '1.9.0'` succeeds before bundling. 

此命令不工作,要麼(創業板安裝FFI -v「1.9 .0'),我得到了同樣的錯誤。我想:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2 

我已閱讀:

can't setup ruby environment - installing fii gem error

Bundle update fails on ffi

Bundle update fails on ffi

Error installing ffi

gem install ffi -v '1.1.5' osx 10.8

雖然沒有運氣。我跟着這個指南設置RVM:

http://portertech.ca/2010/03/26/homebrew--rvm--awesome/

如果這會有所幫助,FFI-1.0.11安裝不順利,FFF-1.9.0將無法安裝(http://rubygems.org/gems/ffi/versions)。

/Users/Sam/.rvm/gems/[email protected]/gems/ffi-1.0.11 (no problem) 

我只想使用命令行(而不是珠寶盒GUI)來學習一些新技能,但相當困難。任何幫助將不勝感激,謝謝。

編輯

所以我嘗試了不同的方法,我想也許這是紅寶石的版本是不兼容:

rvm install 2.0.0 

然後使用Ruby 2.0.0

創造寶石此時
rvm use [email protected] --create 

檢查它是否存在並選擇爲當前gemset(準備安裝一些寶石)

rvm gemset list 

gemsets for ruby-2.0.0-p247 (found in /Users/Sam/.rvm/gems/ruby-2.0.0-p247) 
(default) 
global 
=> omega.ecoop 

是的一切都好。嘗試並安裝

bundle install 

Sams-MacBook-Pro:ecoop Sam$ bundle install 
Fetching gem metadata from https://rubygems.org/.......... 
Fetching gem metadata from https://rubygems.org/.. 
Resolving dependencies... 
Installing addressable (2.3.5) 
Installing chunky_png (1.2.8) 
Installing fssm (0.2.10) 
Installing sass (3.2.10) 
Installing compass (0.12.2) 
Installing breakpoint (2.0.6) 
Installing coderay (1.0.9) 
Installing compass-blend-modes (0.0.2) 
Installing color-schemer (0.2.5) 
Installing compass-normalize (1.4.3) 
Installing compass-rgbapng (0.2.1) 
Installing compass-validator (3.0.1) 
Installing css_parser (1.3.5) 
Installing eventmachine (1.0.3) 
Installing http_parser.rb (0.5.3) 
Installing em-websocket (0.5.0) 
Installing ffi (1.9.0) 
Installing formatador (0.2.4) 
Installing rb-fsevent (0.9.3) 
Installing rb-inotify (0.9.1) 
Installing rb-kqueue (0.2.0) 
Installing listen (1.3.0) 
Installing lumberjack (1.0.4) 
Installing method_source (0.8.2) 
Installing slop (3.4.6) 
Installing pry (0.9.12.2) 
Installing thor (0.18.1) 
Installing guard (1.8.2) 
Installing guard-compass (0.0.8) 
Installing multi_json (1.7.9) 
Installing guard-livereload (1.4.0) 
Installing guard-shell (0.5.1) 
Installing oily_png (1.1.0) 
Installing rb-fchange (0.0.6) 
Installing sass-globbing (1.1.0) 
Installing sassy-strings (1.0.0) 
Installing singularitygs (1.1.2) 
Installing susy (1.0.9) 
Installing toolkit (1.3.7) 
Installing yajl-ruby (1.1.0) 
Using bundler (1.3.5) 
Your bundle is complete! 

這次沒有'安裝ffi(1.9.0)'的問題。然後,我刪除了紅寶石1.9.3,因爲此刻我只將它用於指南針/ sass/susy,如果2.0.0有效,那就這樣吧。

Sams-MacBook-Pro:~ Sam$ ruby -v 
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0] 
Sams-MacBook-Pro:~ Sam$ cd drupal/ecoop/sites/default/themes/ecoop/ 
ruby-1.9.3-p448 is not installed. 

To install do: 'rvm install ruby-1.9.3-p448' <<<<<< no thanks 

Sams-MacBook-Pro:ecoop Sam$ compass watch 
>>> Change detected at 12:35:09 to: reset.scss 
overwrite css/reset.css 
overwrite css/styles.css 
>>> Compass is watching for changes. Press Ctrl-C to Stop. 

現在適合我的項目。不確定使用更新版本的紅寶石有什麼後果,但已經失去了足夠的時間,需要做一些設計。很顯然,這不會幫助需要1.9.3的人,因此ffi不會安裝的原始查詢尚未得到解決。

+1

我在另一臺機器上遇到同樣的問題。我的一臺機器工作正常,第二臺機器基本上以相同的方式設置。真的只是想堅持1.9.3,因爲我試圖將其複製到其他人機器上。甚至試圖在它自己的結果中安裝ffi gem的結果與「無法構建本機擴展」相同。所有的Xcode和命令行工具更新..自制更新,等等等。 – humanaut

回答

0

您需要確保已安裝gcc46

嘗試brew install gcc46然後重新運行bundle install

+0

謝謝亞歷克斯。我現在在使用ruby 2.0.0p247,並沒有試圖返回並安裝早期版本,所以我不能說這是否解決它。 – Sam

+2

錯誤:沒有可用的公式gcc46 – humanaut

+1

@briggimus同樣的錯誤在這裏/錯誤:沒有可用的公式gcc46 –

1
Sams-MacBook-Pro:~ Sam$ cd drupal/ecoop/sites/default/themes/ecoop/ 
ruby-1.9.3-p448 is not installed. 

To install do: 'rvm install ruby-1.9.3-p448' <<<<<< no thanks 

該目錄中的.ruby-version文件仍然是1.9.3。

1

我的兩美分,好吧。

我遇到過這個問題,同時運行的軟件包時,安裝步驟11之前試圖install an Omega 4 subtheme in Drupal(未在指南中提到的......嘆了口氣。)

歐米茄擁有佔位符稱爲{{ THEME }}的負載,其意是取而代之的是你的自定義主題名稱 - 並以某種方式(原諒我,因爲我對Ruby一無所知!)它試圖在gemfile中使用這個奇怪的佔位符和空格。

它也嘗試將寶石保存到文件夾/home/ubuntu/.rvm/gems/[email protected]{{ THEME }}/gems,我知道這個文件夾看上去很不錯。

要解決它,我做了以下內容:

rvm use [email protected] --create 
rvm gemset list 

    gemsets for ruby-1.9.3-p547 (found in /home/ubuntu/.rvm/gems/ruby-1.9.3-p547) 
    (default) 
    global 
    => omega.mysubtheme 
    omega.{{ THEME }} 

bundle install # This now works! 

希望這可以幫助別人!結論是,這通常是文件名空間的問題 - 許多人在OSX上遇到問題,因爲它解決了「Macintosh HD」這個無效名稱的路徑。

0

通常當我遇到這個問題時,解決方案是確保Xcode已更新。