Re: Library dependencies in gtk+




Toshio Kuratomi <badger@prtr-13.ucsc.edu> writes:

> [1  <text/plain; us-ascii (7bit)>]
> On Sat, 07 Mar, 1998 at 05:12:26PM -0500, Owen Taylor set free these words:
> > 
> > Toshio Kuratomi <badger@prtr-13.ucsc.edu> writes:
> > 
> > > [1  <text/plain; us-ascii (7bit)>]
> > > Hi.
> > >     Any reasons for not adding interlibrary dependencies between the
> > > gtk libraries?  (So when we link gtk into a program, we know to link
> > > glib and gdk as well.)  I know the libtool documentation says you can't link
> > > to uninstalled libs, but it's wrong on this account.  What you can't do is
> > > link to a relative path... I put
> > > 
> > >     -L`pwd`/../glib/.libs -lglib 
> > > 
> > > into the libgdk_la_LDFLAGS variable in gdk/Makefile.am and it worked fine.
> > > (Same sort of thing with gtk/Makefile.am)
> > > 
> > > Will that work for everyone?
> > 
> > No. This sort of thing does not work on most non-ELF platforms.
> > 
> > In fact, even the current linking against installed libraries can
> > produce bad results if the installed libraries happen to be
> > static. Versions of libtool after 1.0f disable such linking
> > entirely. (We've avoided upgrading for this reason, but there is a
> > good case to be made that we _should_ upgrade - it is better to make
> > people add a few libraries to there command line, than to have GTK
> > refuse to build on some platforms)
> > 
> Ah, but libtool is supposed to decide internally whether it is safe to link
> libraries in on the system it is invoked on.  So the dependencies should be
> in the Makefile.am -- They just won't be used on all platforms.
> 
> Does 1.0f not work this way?  I'm working on patching library dependencies
> into libtool and I'm pretty sure they will provide functionality in this
> manner.  (Should appear in 1.1 or 1.2 release, after Gordon looks over my
> patches and tests/incorporates them.)

The problem was (at least partially) that libtool 1.0f couldn't tell
if a given library is static or shared. If you made improvements
to libtool and Gordon puts them in, that would be great. 

But, I don't think we should try to work around libtool on this,
because we don't have a good way to make sure that GTK is tested
on a huge range of machines, and, in the end, shared library 
dependencies are just a minor convenience.

Because shared library dependencies _don't_ exist on all platforms,
and because people may want to link things statically, you should
never write a makefile that just says:

LIBS=-lgtk

  or even

LIBS=-lgtk -lgdk -lglib

You need to have the X libraries there as well.

Regards,
                                        Owen



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