Article View: gnu.gcc.help
Article #49431Re: GCC 2.5.8/Solaris 2.2: turning dynamic linking off and on
From: Jerry Frain
Date: Fri, 28 Jan 1994 04:10
Date: Fri, 28 Jan 1994 04:10
48 lines
2510 bytes
2510 bytes
irving@sys.toronto.edu (Irving Reid) writes:
>We are trying to build a Motif application under Solaris 2.2 using GCC.
>Not all of the machines running this application have Motif installed,
>so we would like to statically link the Motif libraries while dynamically
>linking all the others.
[ ... ]
>I would rather not have to statically link all the system libraries, both
>because of size and because of backward compatibility problems. I would
>also prefer not to write the /usr/ccs/bin/ld command line by hand, because
>it has path names of files under gcc-lib which I would have to change
>every time we compile with a different version of gcc.
I've run into this problem as well. My ``solution'' was to write the
following script, which is saved as /opt/local/bin/gcclibdir:
#!/bin/sh
#
# print the gcc library directory to stdout
#
case $# in
0) GCC=gcc
;;
1) GCC=$1
;;
*) echo "usage: `basename $0` [gcc]" >&2
exit 1
esac
$GCC -v 2>&1 | awk '{if (NR==1) print $4}' | sed -e 's/\/specs//'
I then have something like the following in my makefile:
GCCLIBDIR=$(shell gcclibdir)
LINK.o = ld -e _start -L/opt/local/lib -L$(GCCLIBDIR) $(GCCLIBDIR)/crt1.o $(GCCLIBDIR)/crti.o /usr/ccs/lib/values-Xa.o $(GCCLIBDIR)/crtbegin.o
LIBS = -lsocket -lnsl -lintl -ltermcap -Bstatic -lXaw -lXmu -lXt -lXext -lX11 -lgcc -Bdynamic -lc $(GCCLIBDIR)/crtend.o $(GCCLIBDIR)/crtn.o
Yeah, it's ugly, but it works.
--
Jerry Frain | TIVOLI Systems, Inc. | Phone: (512) 502-4694
| 6034 W. Courtyard Dr. #210 | FAX: (512) 794-0623
Jerry.Frain@Tivoli.COM | Austin, TX 78730, USA |
Technical Details
Message-ID:
<jerry.759730250@kenya>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.belwue.de!news.dfn.de!news.dfn.de!zib-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!tivoli.tivoli.com!jerryReferences:
<1994Jan27.204635.21808@jarvis.csri.toronto.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,a82797485222b85 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1994-01-28 15:37:15 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.belwue.de!news.dfn.de!news.dfn.de!zib-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!tivoli.tivoli.com!jerry From: jerry@tivoli.com (Jerry Frain) Newsgroups: gnu.gcc.help Subject: Re: GCC 2.5.8/Solaris 2.2: turning dynamic linking off and on Date: 28 Jan 94 04:10:50 GMT Organization: Tivoli Systems, Inc. Lines: 48 Message-ID: <jerry.759730250@kenya> References: <1994Jan27.204635.21808@jarvis.csri.toronto.edu> NNTP-Posting-Host: kenya.tivoli.com