sstephenson/ruby-build — Issue #69: ree-1.8.7-2011.03 fails to install on OSX Lion (readline issues)
Author: matthutchinson
Created: 2011-10-20 12:27:57+00:00
State: open

I came across this issue with ruby-build, OSX Lion and REE (ree-1.8.7-2011.03)
Basically I couldn't install it properly due to common Readline issues, mentioned here

```
readline.c: In function ‘username_completion_proc_call’:
readline.c:734: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:734: error: (Each undeclared identifier is reported only once
readline.c:734: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
```

I have readline installed OK (via brew) to /usr/local/Cellar/readline/6.2.1and the solution is to supply the REE installer with the --with-readline-dir configure option. So naturally I tried;

`CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install ree-1.8.7-2011.03`

Unfortunately, looking in the code for [ruby-build](https://github.com/sstephenson/ruby-build/blob/master/bin/ruby-build), it seems that CONFIGURE_OPTS is ignored for REE installs

The `build_package_ree_installer` method pays no attention to the CONFIGURE_OPTS environment variable.

To compound the problem on OSX Lion, we can't simply use CONFIGURE_OPTS as an argument to the REE ./installer command, since its prefixed with '--with-gcc' set in the `use_gcc42_on_lion` method.

My suggested fix below introduces a new env variable, REE_CONFIGURE_OPTS, used only in the `build_package_ree_installer ` method. With this patch applied, I could now successfully install REE on OSX Lion with the following command to rbenv;

`REE_CONFIGURE_OPTS="-c --enable_shared -c --with-readline-dir=$(brew --prefix readline)" rbenv install ree-1.8.7-2011.03`

Any questions or comments, or if you've had the same problem please let me know.

Matt

Patch

```
- 138: { ./installer --auto "$PREFIX_PATH" --dont-install-useful-gems $options
+ 138: { ./installer --auto "$PREFIX_PATH" --dont-install-useful-gems $options $REE_CONFIGURE_OPTS
```