horseyguy
horseyguy

Reputation: 29895

how to pass compilation flags when compiling ruby with rbenv?

I saw this post explaining how to compile rubies for rvm with -O3 and so on, but how do i do the equivalent with rbenv? in particular i want -O0 -g3 (no optimization, and highest debugging level)

Upvotes: 2

Views: 1797

Answers (2)

Raels
Raels

Reputation: 400

This page says you can do it this way:

If you want to compile Ruby with your preferred versions of OpenSSL, Readline and LibYAML you just need to export or append RUBY_CONFIGURE_OPTS to your installation command.

I haven't tried it yet, but I will when I get to my dev machine.

Upvotes: -1

postmodern
postmodern

Reputation: 454

You can export CFALGS or pass additional configuration flags to the ruby-build via the CONFIGURE_OPTS env variable. However, this might be a case where ruby-build is actually impeding you. Since rbenv install simply calls ruby-build $DEFINITION ~/.rbenv/versions/$DEFINITION and rbenv can use any Ruby in ~/.rbenv/versions/, you could configure Ruby manually:

$ CFLAGS="-O0 -ggdb" ./configure --prefix=~/.rbenv/versions/1.9.3-debug
$ make
$ make install 

Upvotes: 2

Related Questions