2

I have an app on the Heroku Bamboo stack and have been following the instructions here (https://devcenter.heroku.com/articles/cedar-migration) for migrating to the Cedar stack.

My app has an older version of RefineryCMS (1.0.3) and I'm trying to avoid dealing with an upgrade there (for now), and so I've kept Rails at 3.0.9. Still, Ruby 1.8.7 is past EOL, so I needed to upgrade that at least. I specified 1.9.3 in my Gemfile, thus:

source "https://rubygems.org"
ruby "1.9.3"

And then I attempted to bundle install. Here's my output from that attempt:

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.

Needless to say gem install RedCloth -v '4.2.7' resulted in the same error.

I found this question, Failed to build gem native extension when install RedCloth-4.2.9 install Linux, however, my issue was with RedCloth 4.2.7 (not 4.2.9) and I'm running OSX Yosemite (not Linux). There was an answer there which pertained to OSX Mountain Lion though, and I thought it was worth a try:

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

Obviously, I changed 1.9.2 to 1.9.3 for my purposes, and I omitted the --no-ri --no-rdoc flags. Sadly, bundle install continued to fail with the same error.

Continuing my search online, I found this article, Install RedCloth 4.2.7 gem with bundler (using ruby enterprise edition 1.8.7). Not dissuaded by the version mismatch (again, I'm using Ruby 1.9.3, not 1.8.7), I decided to try the advice I found there, to wit:

bundle config build.RedCloth --with-cflags=-w
bundle install

This time, oh joy! it worked! And I'm on to whatever's next. I thought I would share this little journey here for any others who find themselves in the same predicament. Cheers!

Community
  • 1
  • 1
Day Davis Waterbury
  • 2,052
  • 18
  • 31

1 Answers1

3

I was able to resolve this issue by specifying extra build options for Bundler which are applied when building RedCloth, as follows:

bundle config build.RedCloth --with-cflags=-w
bundle install
Day Davis Waterbury
  • 2,052
  • 18
  • 31
  • Worthy of note that, although this resolved the issue locally, when I push to Heroku, the bundle there fails because it doesn't have the build flags. Still working on a solution for that, and have an open support ticket. – Day Davis Waterbury Nov 05 '15 at 22:25
  • "Run `bundle config --local build.RedCloth --with-cflags=-w`, add and commit the `.bundle/config` file it generates. Push to Heroku." --Steven@Heroku – Day Davis Waterbury Nov 12 '15 at 17:20