1

我在 Heroku Bamboo 堆栈上有一个应用程序,并且一直按照此处的说明 ( https://devcenter.heroku.com/articles/cedar-migration ) 迁移到 Cedar 堆栈。

我的应用程序有旧版本的 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 Yosemite(不是 Linux)。那里有一个与 OSX Mountain Lion 相关的答案,我认为值得一试:

rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install

显然,为了我的目的,我改成1.9.21.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

这一次,哦,快乐!有效!我正在做接下来的事情。我想我会在这里为任何发现自己处于同样困境的其他人分享这个小旅程。干杯!

4

1 回答 1

2

我可以通过为构建 RedCloth 时应用的 Bundler 指定额外构建选项来解决此问题,如下所示:

bundle config build.RedCloth --with-cflags=-w
bundle install
于 2015-11-05T21:25:44.103 回答