>>>> "Darryl" == Darryl Okahata
<darrylo(a)soco.agilent.com> writes:
Darryl> Martin Buchholz <martin(a)xemacs.org> wrote:
> There is no libXp in my OpenMotif 2.1.30 installed on Linux.
Darryl> Yes, but your copy of OpenMotif references libXp -- see below.
> If motif/lib/Xm/PrintS.c was supposed to contribute to libXp.so,
why
> isn't it in motif/lib/Xp/PrintS.c ?
Darryl> You have it backwards (or maybe I'm misunderstanding your
Darryl> english). There are new (?) Motif print routines in OpenMotif, and
Darryl> these routines call functions in the X print library (libXp).
> (martin@lasker) /usr/local/dt/lib $ ldd libXm.so
> libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x401b5000)
> libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x401ff000)
> libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40208000)
> libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x4021e000)
Darryl>
^^^^^^^^^^
Darryl> Huh? This looks like libXp to me.
OOOOPS! I stand corrected. Refuted by my own evidence!
OK, I thought libXp was part of OpenMotif, but no, it's merely *used*
by OpenMotif.
libXp is part of X11R6.
Darryl> Hmmm. I'm not very familiar with Linux. Does Linux have some kind
Darryl> of deferred linking, where symbols in shared libraries are not resolved
Darryl> at link time but at runtime, instead?
Darryl> [ Oh. Ah. If I recall correctly, FreeBSD 3.X (which Kasahara-san is
Darryl> using), did not have deferred linking; all symbols in all libraries
Darryl> had to be resolved (must exist and be found) at link time. FreeBSD
Darryl> 4.X (and probably Linux) use deferred linking, where symbols in shared
Darryl> libraries aren't checked and resolved until runtime (this means that
Darryl> unresolved symbols like XpStartPage would cause a core dump at runtime
Darryl> if the symbol could not be found). This is probably what you're
Darryl> seeing. I'd bet that your XEmacs would dump core if it tried to
Darryl> reference a Motif print function (which references libXp, which
Darryl> doesn't exist on your system). This probably means that someone
Darryl> (you?) will have to change configure to check for libXp on those
Darryl> systems for which deferred linking is not used. ]
Darryl> [ P.S. -- I'm not sure if the correct term is really "deferred
linking",
Darryl> but that's what I've been calling it. ]
(martin@lasker) ~/src $ gcc xm.c
/tmp/cc03owBq.o: In function `main':
/tmp/cc03owBq.o(.text+0xc): undefined reference to `XmStringFree'
(martin@lasker) ~/src $ gcc xm.c -L /usr/local/dt/lib -lXm
(martin@lasker) ~/src $ cat xm.c
int main (int argc, char *argv[]) { XmStringFree(); }
Look at the above. This is the correct way for the system to behave,
I believe.
If app xx uses a symbol from library ll, then xx should only need to
link with ll. If ll in turn needs some other library mm, then that
should be transparent to xx, and taken care of at the time that ll is
built.
Despite my major gaffe above, I believe my point is still valid.
Note that libXm.so's dependencies are recorded in the libXm.so file.
So when a user links with libXm.so, the linker is smart enough to
(recursively) link in libXp.so from elsewhere.
If the BSD linker is so stupid that it is impossible to use -lXm
without also specifying -lXp, then BSD as a whole is horribly broken.
But I don't believe that.
Here is some documentation from GNU ld, apparently used by freebsd:
`-rpath-link DIR'
When using ELF or SunOS, one shared library may require another.
This happens when an `ld -shared' link includes a shared library
as one of the input files.
When the linker encounters such a dependency when doing a
non-shared, non-relocateable link, it will automatically try to
locate the required shared library and include it in the link, if
it is not included explicitly. In such a case, the `-rpath-link'
option specifies the first set of directories to search. The
`-rpath-link' option may specify a sequence of directory names
either by specifying a list of names separated by colons, or by
appearing multiple times.
The linker uses the following search paths to locate required
shared libraries.
1. Any directories specified by `-rpath-link' options.
2. Any directories specified by `-rpath' options. The difference
between `-rpath' and `-rpath-link' is that directories
specified by `-rpath' options are included in the executable
and used at runtime, whereas the `-rpath-link' option is only
effective at link time.
3. On an ELF system, if the `-rpath' and `rpath-link' options
were not used, search the contents of the environment variable
`LD_RUN_PATH'.
4. On SunOS, if the `-rpath' option was not used, search any
directories specified using `-L' options.
5. For a native linker, the contents of the environment variable
`LD_LIBRARY_PATH'.
6. The default directories, normally `/lib' and `/usr/lib'.
If the required shared library is not found, the linker will issue
a warning and continue with the link.
Martin