我在Heroku Bamboo堆棧上有一個應用程序,並且已經按照此處的說明(https://devcenter.heroku.com/articles/cedar-migration)遷移到Cedar堆棧。安裝RedCloth(4.2.7)時發生錯誤,並且Bundler無法繼續
我的應用程序有一箇舊版本的RefineryCMS(1.0.3),我試圖避免處理那裏的升級(現在),所以我一直在Rails 3.0.9。儘管如此,Ruby 1.8.7已經過了EOL,所以我需要至少升級它。我在Gemfile中指定的1.9.3,即:
源 「https://rubygems.org」
紅寶石 「1.9.3」
然後我試圖bundle install
。這是我的輸出:
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 0.8.7
Installing RedCloth 4.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/day/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20151105-14593-x80q4a.rb extconf.rb
checking for main() in -lc... no
creating Makefile
make clean
make
compiling redcloth_attributes.c
ragel/redcloth_attributes.c.rl: In function 'redcloth_attribute_parser':
ragel/redcloth_attributes.c.rl:26:11: error: variable 'act' set but not used [-Werror=unused-but-set-variable]
ragel/redcloth_attributes.c.rl: In function 'redcloth_attributes':
ragel/redcloth_attributes.c.rl:45:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
ragel/redcloth_attributes.c.rl: In function 'redcloth_link_attributes':
ragel/redcloth_attributes.c.rl:54:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
cc1: all warnings being treated as errors
make: *** [redcloth_attributes.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/day/.rvm/gems/ruby-1.9.3-p551/gems/RedCloth-4.2.7 for inspection.
Results logged to /Users/day/.rvm/gems/ruby-1.9.3-p551/extensions/x86_64-darwin-14/1.9.1/RedCloth-4.2.7/gem_make.out
An error occurred while installing RedCloth (4.2.7), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.7'` succeeds before bundling.
不用說gem install RedCloth -v '4.2.7'
導致了相同的錯誤。
我發現這個問題,Failed to build gem native extension when install RedCloth-4.2.9 install Linux,但是,我的問題是與RedCloth 4.2.7(不是4.2.9),我正在運行OSX優勝美地(而不是Linux)。有一個答案了,這pertained到OSX山獅雖然,我認爲這是值得一試:
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
很顯然,我改變1.9.2
到1.9.3
我的目的,我省略了--no-ri --no-rdoc
標誌。可悲的是,bundle install
繼續失敗,同樣的錯誤。
繼續我的在線搜索,我發現這篇文章,Install RedCloth 4.2.7 gem with bundler (using ruby enterprise edition 1.8.7)。由版本不匹配(再次,我使用Ruby 1.9.3,1.8.7不)不勸阻,我決定嘗試,我發現那裏的建議,即:
bundle config build.RedCloth --with-cflags=-w
bundle install
這一次,哦喜悅!有效!而且我接下來要做的事情。我以爲我會在這裏分享這個小小的旅程,以便找到處於同樣困境中的其他人。乾杯!
沃西,當我推到Heroku,那裏的包因爲沒有構建標誌而失敗。仍然在爲此提供解決方案,並且有一個開放的支持票證。 –
「Run'bundle config --local build.RedCloth --with-cflags = -w',添加並提交它生成的'.bundle/config'文件。推送到Heroku。」 --Steven @的Heroku –