Re: XForms: Linking a pseudo-static version

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 31 Jul 97 06:10:06 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have run on the following problem, I wish to generate a
> pseudo-static binary version of the program with an `older' library
> of XForms. ...
>
> I am on a Solaris 2.5/Sparc using GNU C (gcc) version 2.7.2.2,
> I compile/link with the following:
>
> gcc -O2 -L/lcl/lib -g -I/lcl/include -static -lm -lsocket -lnsl \
> -lX11 -lforms -o myprog myprog.c myproc_misc.c

I don't know if this is the solution or not but on SGIs where I wish
to link the library statically, I use

gcc [...] -Xlinker -B -Xlinker static \
-lforms -Xlinker -B -Xlinker dynamic -lX11 [...]

In other words, you may need to use the gcc -Xlinker escape to pass
linker options directly to the command line of the linker.

I also note that the ordering of your libraries is exactly reversed
from the way that I'd normally expect them:

[...] -lforms -lX11 [...] -lm

I often find that if I'm having some sort of puzzling linker problem
that using the gcc -v option helps -- it will print out the command
lines passed to each stage of the compilation/linking process so you
can see exactly what's happening or what's getting mangled in an
especially complicated operation.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/