XForms: The solution (was Linking static version)

Emilio Grimaldo (emilio@irdeto.nl)
Fri, 01 Aug 1997 13:34:43 +0200

To subscribers of the xforms list from Emilio Grimaldo <emilio@irdeto.nl> :

Hi,
After some struggling I managed to get it to work so here I go
to share the information in case it is of use for somebody.

Platform:
In my case, Sun Solaris 2.5 with gcc 2.7.2.2

Problem:
To make a pseudo-static version of an application using XForms.
The resulting application will still use the shared libraries
of X11, Xm, socket, nsl but use a static version of XForms
(libforms.a), useful when the target machine doesn't have the
necessary libs or when wanting to link with an old (or beta)
library.

I noticed that when doing a (pseudo) static I also had to
specify the Xpm library (-lXpm).

Command used: (depends on system installation)
CFLAGS = -O2
LDFLAGS = -L/lcl/lib
INC = -I/lcl/include
STAT_ON = -Xlinker -B -Xlinker static
STAT_OFF= -Xlinker -B -Xlinker dynamic
LIBS = -lforms -lm -lsocket -lnsl -lX11
SLIBS = $(STAT_ON) -lforms -lXpm $(STAT_OFF) -lm -lsocket \
-lnsl -lX11

gcc $(CFLAGS) $(LDFLAGS) $(INC) -o myprog $(SRC) $(SLIBS)

When building the executable with only shared libs I use
the LIBS version instead of SLIBS.

Well, that worked for me :-) I noticed that on other systems I
don't need to specify -lsocket -lnsl but...

Cheers,
Emilio

PS. Thanks Steve Lamont for the tip regarding the -Xlinker thing.

-- 
  D. Emilio Grimaldo T.                       Irdeto Consultants B.V.
  Technology Control Systems (TCS)            Hoofddorp, The Netherlands
  EMAIL: emilio@irdeto.nl		      HTTP://www.irdeto.com
	 egrimald@nethold.nl		      Phone: +31 (0)23 568 6756
					      Mobile: +31 (0)6 No-Yupie
_________________________________________________
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/