Re: Static build of psql with readline support

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Static build of psql with readline support
Date: 2006-03-16 08:53:41
Message-ID: 20060316085341.GB20889@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 16, 2006 at 04:09:53PM +1300, Mark Kirkwood wrote:
> Christopher Kings-Lynne wrote:
> >Hi guys,
> >
> >I've been trying to build the cvs checkout of 8.1.3 on my freebsd 4.9
> >box with a STATIC psql utility. I keep getting failures trying to hook
> >in libreadline I think:

<snip>

> Add a -lcurses as well, as it seems that as soon as you force static,
> libreadline needs to be told explicitly about libcurses. I'm on FreeBSD
> 6.0, but hopefully this is what is going on on 4.9 too.

Shared libraries can declare their own dependancies, static libs
cannot. So when doing shared linking you only need to specify the libs
you directly use. For static linking you need to list every library
used by you and the libraries used by those libs etc, etc... The link
lines for static linking are quite different from those for dynamic
linking.

This is incidently one of the reasons why people use libtool. If you
specify static linking, libtool pulls up the .la files scattered across
your disk to determine which libs are dependant on other libs. For
dynamic linking the linker figures it out. For static it takes more
legwork.

Given the amount of legwork needed to make static linking work, is it
worth supporting. readline is an easy case, it only depends on one
other lib. libssl depends on 3 and libkrb5 on 5 other libs. For static
linking we need to specify them all...

To the GP, adding -lncurses (or rather the static equivalent) to your
link line should solve it. But if you include any other libraries like
ssl or kerberos be prepared to add a lot more.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-03-16 09:11:23 Bug report form: locale/encoding
Previous Message Jeroen T. Vermeulen 2006-03-16 04:26:44 Re: Pregunta sobre limitar el