Had a lot of trouble getting Ruby 1.8.7 (p160), readline and openssl to combine to let ruby compile on Snow Leopard.
Solution:
readline-6.0
./configure –prefix=/opt/ruby187rubygems135
make
sudo make install
For ruby:
./configure –prefix=/opt/ruby187rubygems135 –disable-pthread –enable-shared –with-readline-dir=/opt/ruby187rubygems135
make
sudo make install
Note that specifying something like ‘-with-openssl=/usr’ breaks the compile. Leaving the SSL option off works.
A clean install of readline yields the following files in relative to the installation base:
/include
/include/readline
chardefs.h
history.h
keymaps.h
readline.h
rlconf.h
rlstdc.h
rltypedefs.h
tilde.h
/lib
libhistory.5.2.dylib
libhistory.5.dylib
libhistory.a
libhistory.dylib
libreadline.5.2.dylib
libreadline.5.dylib
libreadline.a
libreadline.dylib
With great thanks to Gravitas for saving hours of fruitless labors.
Symptom:
All ruby command-line tools – irb, console – fail to respond to terminal keys – e.g. cursor keys
Solution:
readline
make clean
./configure CPPFLAGS=-DNEED_EXTERN_PC SHOBJ_LDFLAGS=-dynamiclib
make CPPFLAGS=-DNEED_EXTERN_PC SHOBJ_LDFLAGS=-dynamiclib
sudo make install
ruby
make clean
./configure --prefix=/usr/local --disable-pthread --with-readline-dir=/usr/local --enable-shared
make
sudo make install
See also OS X Leopard – readline compile errors
Taken verbatim from Building readline 5.2 on OS X Leopard
Readline 5.2 does not build properly on OS X Leopard. It fails with a
-compatibility_version only allowed with -dynamiclib
error. I ran into this problem when trying to build ruby, using GNU readline instead of the default editline. The problem is easily fixed though. Readline explicitly checks for the darwin version, but does not include 9 (Leopard) in this check. Patch support/shobj-conf using the following:
--- support/shobj-conf 2007-12-26 18:30:46.000000000 +0900
--- support/shobj-conf 2007-12-26 18:30:46.000000000 +0900
+++ support/shobj-conf.new 2007-12-26 18:30:39.000000000 +0900
@@ -142,7 +142,7 @@
;;
# Darwin/MacOS X
-darwin8*)
+darwin89*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
@@ -171,7 +171,7 @@
SHLIB_LIBSUFF='dylib'
case "${host_os}" in
- darwin[78]*) SHOBJ_LDFLAGS=''
+ darwin[789]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
*) SHOBJ_LDFLAGS='-dynamic'
Also see readline and ruby – When bad things happen