Bug #3698

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

Added by Flameeyes (Diego Elio Pettenò) over 9 years ago. Updated over 8 years ago.

Target version:
ruby -v:
ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-linux]


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.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
readline.o: In function readline_readline':
readline.c:(.text+0x13c6): undefined reference to
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.


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.



Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Category set to ext
  • Status changed from Open to Assigned
  • Assignee set to kouji (Kouji Takao)




Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • 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