看板 Ruby 關於我們 聯絡資訊
※ 引述《shapa5566 (瞎趴哥)》之銘言: : 版上大大好 : 我是剛學習ruby on rails的新手 : 在sudo gem install rails出現問題 : Building native extensions. This could take a while... : ERROR: Error installing rails: : ERROR: Failed to build gem native extension. : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb : creating Makefile : make "DESTDIR=" : compiling generator.c : linking shared-object json/ext/generator.bundle : clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future] : clang: note: this will be a hard error (cannot be downgraded to a warning) in the future : make: *** [generator.bundle] Error 1 : Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. : Results logged to /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out : 也google過 還是不知道怎樣解決這個問題 : 想請教大大如何解決? : 謝謝 這是新版 Clang 的「功能」, 會把不存在的 command line option 當成錯誤 (GCC 和舊版 Clang 都是 warning 而已) 解法是在開始 build 之前設定兩個環境變數 $ export CFLAGS=-Qunused-arguments $ export CPPFLAGS=-Qunused-arguments 然後再開始 如果有用到 sudo (例如你這邊的例子) 則要改用 sudo -E 讓環境變數可以過去 如果還是不能過, 試著再加上一個環境變數 ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future 參考資料 http://stackoverflow.com/questions/22313407/ 前兩個解答都看一下會比較清楚 這是在講安裝 Python 模組 (pip install) 不過概念一樣 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.161.94.175 ※ 文章網址: http://www.ptt.cc/bbs/Ruby/M.1397253049.A.C68.html
kusoayan:如果用 homebrew 裝 gcc,也是如此嗎? 04/12 16:44
alog:先裝xcode跟compile套件(xcode自附) 再裝rvm用它安裝 ruby 04/20 19:52
alog:再來 gem install rails (從來沒遇過這些問題 @.@ 04/20 19:53