Bug #3698
closedBuilding the readline extension against libedit will create a non-working extension
Description
=begin
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.
=end
Updated by usa (Usaku NAKAMURA) over 14 years ago
- Category set to ext
- Status changed from Open to Assigned
- Assignee set to kouji (Kouji Takao)
=begin
=end
Updated by nobu (Nobuyoshi Nakada) over 14 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
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.
=end