Last Updated: February 25, 2016
·
1.325K
· rmontgomery429

Optimize Ruby Compilation

Ok, so this guy wrote about some CFLAGS you can set when compiling ruby to improve performance and after I did so, I ran into some issue with gems that did not like my new default CFLAGS.

First I re-installed my ruby like so.

$ CC=clang rvm reinstall 1.9.3 --patch falcon

Then I ran $ bundle and received compilation errors. To get around these errors I did the following for each:

$ gem install <gem_name> -v 'x.x.x' -- --with-cflags="-02 -pipe -march=native -w"

In particular I had issues with debugger-linecache, eventmachine, nokogiri, and therubyracer.

3 Responses
Add your response

Sweet!

over 1 year ago ·

Just a fyi the flag on the gem install line says clfags. Humorous, but I don't think that's quite correct :)

over 1 year ago ·

:) Good catch. Thanks!

over 1 year ago ·