Bug #3698 [ruby-core:31722]

Building the readline extension against libedit will create a non-working extension

Added by Diego E. Pettenò 8 days ago. Updated 7 days ago.

Status :Closed Start :08/15/2010
Priority :Normal Due date :
Assigned to :Kouji Takao % Done :

100%

Category :ext
Target version :-
ruby -v :

ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-linux]


Description

We're hitting a bug in Gentoo due to our adding further safety flags into our Ruby build: ruby 1.9.2_rc2 fails to build the libedit-based readline extension because of two missing symbols in link:


i686-pc-linux-gnu-gcc -shared -o ../../.ext/i686-linux/readline.so readline.o -L. -L../.. -L. -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -rdynamic -Wl,-export-dynamic -Wl,--no-undefined   -Wl,-R -Wl,/usr/lib -L/usr/lib -lruby19 -ledit -lncurses  -lpthread -lrt -ldl -lcrypt -lm   -lc
readline.o: In function `readline_getc':
readline.c:(.text+0x7b): undefined reference to `rl_getc'
readline.o: In function `readline_readline':
readline.c:(.text+0x13c6): undefined reference to `rl_free_line_state'
collect2: ld returned 1 exit status

Given that the default for Ruby is not to use --no-undefined this was _mostly_ passing through unnoticed. What could have been seen was the "implicit declaration", but revision 28631[1] added a faux declaration that caused the compiler to stop complaining.... even though the function _is not there at all_.

[1] http://redmine.ruby-lang.org/repositories/diff/ruby-19/ext/readline/readline.c?rev=28631

as far as I can see there is no support for either two functions in libedit even on the original NetBSD code.

NOTE: as it is, the extension will build with the default Ruby build flags (that don't include --no-undefined), but when loading the extension at runtime... it'll cause the process to abort because of missing symbols, which is quite bad.

Associated revisions

Revision 29019
Added by nobu 7 days ago

Tue Aug 17 07:50:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>

History

08/16/2010 11:31 AM - Usaku NAKAMURA

  • Category set to ext
  • Status changed from Open to Assigned
  • Assigned to set to Kouji Takao

08/17/2010 07:57 AM - Nobuyoshi Nakada

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r29019.
Diego E., thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF