[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] Re: [bug-inetutils] inetutils-1.8: ftp build error

From: Chet Ramey
Subject: Re: [Bug-readline] Re: [bug-inetutils] inetutils-1.8: ftp build error
Date: Tue, 08 Jun 2010 17:12:40 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20100317 Thunderbird/3.0.4

On 6/8/10 5:20 AM, Bruno Haible wrote:
> Hi,
> Giuseppe Scrivano wrote:
>> The problem is that readline 6.x exports `xmalloc' and `xrealloc', and
>> it causes a linker error when used together with gnulib.
> According to what Chet Ramey said in
>   <http://lists.gnu.org/archive/html/bug-readline/2009-06/msg00003.html>
> it should be possible to override 'xmalloc' and 'xrealloc' in gnulib, and
> libreadline should then use the definitions from gnulib. Recall that gnulib
> links statically into the program; gnulib is not compiled into a shared
> library.

There are two important things to remember: linking happens beginning to
end on the command line, and the linker works at file scope.

The first means that if an application provides its own definition of
xmalloc/xrealloc/xfree, or somehow arranges for those symbols to be
defined by the time readline is linked, readline's version will not be

The second thing is that the linker works on files: when it links a file
that provides a particular function definition, all functions in that file
are linked.  The gnulib interface defines many more functions than the
readline one: x2realloc, xcalloc, xzalloc, etc.  If the application or
gnulib itself uses any of those `extra' functions, the entire file from
gnulib will be linked in, and you'll get a redefined symbol error.

The first can be solved by putting definitions for xmalloc/xrealloc/xfree
into the program's code or changing the makefile so that gnulib is linked
before readline.  That will probably work for the second also, but if it
doesn't, I don't know if the second can be solved without taking gnulib's
xmalloc.c and adding it to the list of ftp's source/object files.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]