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

Re: ld/Xm/Xt question



On Mon, Jun 21, 1999 at 07:21:14AM -0700, harsh@lanl.gov wrote:
> A few weeks ago I wrote and asked about a problem with X on Slink. Due to the
> under whelming response (including the developers list, except for Oleg who did
> give me some useful info) I upgraded to XFree 3.3.3 from the netgod.net site.
> My test case, at first it appeared to fix the problem but my main app was
> still broken. I noticed by reading the straces of the application runs that on
> my test case that worked I had -lXm before -lXt, and the main app had -lXT -lXm
> on the compile line. Both cases compiled cleanly, without warnings
> or errors, just the app with -lXt -lXm would seg fault and with -lXm -lXt the
> app would run sucessfully.

In general the order of the -l options is important, at least if you have
interlibrary dependencies, which is almost always the case with X
applications.

The "highest" level libraries are listed first, followed by "lower" level
libraries until at the end you have libraries that do not depend on
anything else (except maybe the C library, which is linked by default
except in unusual circumstances).

Consider the output of gtk-config --libs:

-L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl
-lXi -lXext -lX11 -lm

Here we see that we high-level GTK+ and GDK libraries come first, followed
by intermediate libs, and finally wrapping up with libX11 (the core X
protocol library) and the math library, which of course won't be needing
any symbols from fancy GUI libraries.

-- 
G. Branden Robinson              |    A committee is a life form with six or
Debian GNU/Linux                 |    more legs and no brain.
branden@ecn.purdue.edu           |    -- Robert Heinlein
cartoon.ecn.purdue.edu/~branden/ |

Attachment: pgpb7yEUwoRkd.pgp
Description: PGP signature


Reply to: