www.question-defense.com | Engage: Visit :: Login :: Register
Translate to English Übersetzen Sie zum Deutsch/German Переведите к русскому/Russian Μεταφράστε στα ελληνικά/Greek Vertaal aan het Nederlands/Dutch ترجمة الى العربية/Arabic 中文翻译/Chinese Traditional 中文翻译/Chinese Simplified 한국어에게 번역하십시오/Korean 日本語に翻訳しなさい /Japanese Traduza ao Português/Portuguese Traduca ad Italiano/Italian Traduisez au Français/French Traduzca al Español/Spanish
0

When compiling Ruby 1.8.6 (in this case, p287) on OS X 10.5, you may encounter an error similar to the following:

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
make: *** [all] Error 1

Some sites suggest you will need to apply a series of patches to correct this issue and compile for Leopard, but this is not the case. Everything you need comes with OS X by default.

First, make sure your configure line is set up for OS X properly:

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1

Then, if your make command terminates with errors about readline, do:

cd ext/readline
sudo make clean
sudo ruby extconf.rb
sudo make
sudo make install
cd ..

Now make should finish without error, and you can make check and sudo make install as expected.

Thanks to Dan Benjamin for his guide to compiling ruby and brianp’s helpful comment about the need for extconf.rb in that same post, my upgrade from ruby 1.8.4 to 1.8.6 went smoothly.

DeliciousStumbleUponDiggTwitterMixxTechnoratiFacebookNews VineLinkedInYahoo! Bookmarks
Related posts:
  1. completion.rb:10:in `require’: no such file to load — readline (LoadError) Error: /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline...
  2. conftest.c:3: error: ‘mysql_query’ undeclared (first use in this function) When installing the mysql ruby gem you may run across...
  3. Windows XP Ruby Gem, ERROR: Error installing eventmachine: Most gems are very easy to install however they have...
  4. configure: error: Cannot find libmysqlclient under /usr I received the below error when compiling PHP to work as...
  5. Error Building Pyrit On CentOS: cpyrit/_cpyrit_cpu.c:26:18: error: pcap.h: No such file or directory When building pyrit, which is an application that uses GPU...

Tags: , , , , ,
2 Responses to “Compiling ruby on OS X 10.5: readline.c:703: error: ‘filename_completion_function’ undeclared”
  1. Greg says:

    Still get…
    gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.6.0 -I. -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -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 -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -I/usr/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -g -O2 -fno-common -pipe -fno-common -c readline.c
    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: *** [readline.o] Error 1

    [Reply]

  2. Dan says:

    I’ve got pretty much the same thing. readline.c:730 is the problem:

    bash-3.2# make
    gcc -I. -I. -I/usr/local/lib/ruby/1.8/powerpc-darwin8.10.0 -I. -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 -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -I/usr/local/include -fno-common -g -O2 -fno-common -pipe -fno-common -c readline.c
    readline.c: In function ‘readline_readline’:
    readline.c:82: error: ‘rb_io_t’ undeclared (first use in this function)
    readline.c:82: error: (Each undeclared identifier is reported only once
    readline.c:82: error: for each function it appears in.)
    readline.c:82: error: ‘ofp’ undeclared (first use in this function)
    readline.c:82: error: ‘ifp’ undeclared (first use in this function)
    readline.c: In function ‘filename_completion_proc_call’:
    readline.c:703: error: ‘filename_completion_function’ undeclared (first use in this function)
    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: *** [readline.o] Error 1

    Any ideas? Perhaps I should switch over permanently to Windows, which installed flawlessly in a matter of minutes. ;-)

    [Reply]

  3.  
Leave a Reply