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@svana.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.