Is there a rvm env variable for configure flags?

781 views Asked by At

instead of:

rvm install 2.6.6 -C --with-jemalloc

Can I somehow set an environment variable so that I can install rubies without passing configure flags? That is:

rvm install 2.6.6

It seems there's this $rvm_configure_flags var all throughout the rvm codebase so I tried setting that in my environment:

$ echo $rvm_configure_flags
--with-jemalloc

However that appears to not be used, or its clobbered somehow. I've echo $rvm_configure_flags all throughout rvm codebase and can't seem to find where it's getting clobbered.

A fairly old(?) example .rvmrc file appears to suggest this is possible:

https://github.com/rvm/rvm/blob/master/examples/rvmrc#L90-L92

2

There are 2 answers

3
anothermh On

The RVM documentation has a section on compile flags:

If you need to pass compile flags for the compile process, just set the corresponding environment variables.

As an example, to enable gdb for ruby 2.1.1:

$ export optflags="-O0 -ggdb"
$ rvm install 2.1.1
0
b4hand On

The command rvm help install shows the following:

#### .rvmrc equivalents

- `--with-arch`                       `rvm_architectures`
- `-C`                                `rvm_configure_flags`
        ... or per-ruby:              `{jruby|ree|rbx|mruby|macruby|truffleruby}_configure_flags`
- `-E`                                `rvm_configure_env`
- `-M`                                `rvm_make_flags`
- [none]                              `rvm_curl_flags`; default: --max-redirs 10 --max-time 1800

This implies that -C is equivalent to rvm_configure_flags. The documentation has this additional example:

A variable with multiple flags should be set using parentheses and space 
separators. E.g. .rvmrc for `brew`-based `readline`, `llvm`, and 
`openssl` libraries:
```
 # warning: don't use \ linebreaks or it will break.
rvm_configure_env=( LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix llvm)/lib -L$(brew --prefix openssl)/lib" CPPFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix llvm)/include -I$(brew --prefix openssl)/include" CXX=$(brew --prefix llvm)/bin/clang++ CC=$(brew --prefix llvm)/bin/clang )
rvm_archflags="-arch x86_64"
```

I've also confirmed that setting rvm_configure_flags in ~/.rvmrc has the intended effect of passing those options to the ./configure step.