Compiling Ruby 1.8.7 on a PowerBook G4 with Mac OS X 10.4
Posted: 2 years ago (2008-06-22 14:57:53 UTC ) / Updated: 14 months ago (2009-06-01 22:21:52 UTC )
Imported from WordPress
Originally posted on 2008-06-22 14:57:53
I downloaded Ruby 1.8.7, patchlevel 22. Seemed like a good idea at the time. Configured, did a make, waited a bit... Boom.
No, not "boom" like "it works". "Boom" like "it really doesn't work." It appears that:
- Newer versions of the readline library prepend an "rl_" in front of function names
- Newer versions of the readline library obsolete the old rl-less functions
- Ruby is equipped to deal with both, using constants in its 'configure' setup
- Ruby doesn't correctly determine whether my mac has the leading "rl_" or not
The error messages I get look like this:
gcc -I. -I../.. -I../../. -I../.././ext/readline -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -g -O2 -pipe -fno-common -c readline.c
readline.c: In function 'filename_completion_proc_call':
readline.c:703: error: 'filename_completion_function' undeclared (first use in this function)
readline.c:703: error: (Each undeclared identifier is reported only once
readline.c:703: error: for each function it appears in.)
readline.c:703: warning: assignment makes pointer from integer without a cast
readline.c: In function 'username_completion_proc_call':
readline.c:730: error: 'username_completion_function' undeclared (first use in this function)
readline.c:730: warning: assignment makes pointer from integer without a cast
make[1]: *** [readline.o] Error 1
To fix this, I went into the config.h file generated by configure and added some lines:
#define HAVE_RL_FILENAME_COMPLETION_FUNCTION 1
#define HAVE_RL_USERNAME_COMPLETION_FUNCTION 1
#define HAVE_RL_COMPLETION_MATCHES 1
Once I fixed that, everything worked fine, the tests passed, and ruby was ready to go.
