Compiling Ruby on a fresh Lion install
Posted on 25 October 2011
During the setup of my development environment on my new iMac, I’ve run into these two issues while trying to install first Ruby (1.8.7-p352) inside rbenv:
Latest XCode 4.2 does not install (non-llvm) gcc-4.2 anymore
I was getting this error:
./configure: line 3211: /usr/bin/gcc-4.2: No such file or directory
Setting the CC environment variable to use /usr/bin/gcc did fixed compiling, but Ruby was throwing segfaults.
The real fix is to install the osx-gcc-installer.
OS X provides the BSD libedit library, which shadows libreadline
I was getting this error:
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: error: (Each undeclared identifier is reported only once
readline.c:730: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
I’ve fixed it by installing readline with brew and configuring Ruby compilation to use it:
$ brew install readline
$ CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.8.7-p352
I'm Dejan Simic - a Ruby On Rails developer based in infamous Serbia, working remotely for USA companies for few years. I'm currently working for 