Project

General

Profile

Actions

Bug #3698

closed

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

Added by Flameeyes (Diego Elio Pettenò) over 14 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-linux]
Backport:
[ruby-core:31722]

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

Actions

Also available in: Atom PDF

Like0
Like0Like0