From: swettk@my-deja.com
Subject: Re: Linking Statically & Dynamically with GCC
Date: 2000/02/17 [thread overview]
Message-ID: <38ac56ff$0$8289@readdo01.news> (raw)
In-Reply-To: 865b59$pch$1@nnrp1.deja.com
I thought I had this linking problem solved but it's back again in
another form. For review, what I'm trying to do on osf1 v4.0 is to link
some libraries statically (stdc++, qt, etc.) and some dynamically. I'm
presently using the no_so and no_archive flags. It worked previously,
but it doesn't now. I made some changes in the location of some
libraries, which I believe has no affect on this particular problem.
Also, I had to reinstall gcc, which I did several times in different
flavors, vanilla, --enable-shared (even though I don't want to link a
shared libstdc++), and following the platform-specific advice, which
also relates to a shared libstdc++.
The linker is looking for a shared gcc library, adding -lgcc at the end
(see original command line and verbose output below). In another mode,
it looks for a shared libstdc++ library in the same way as it does the
libgcc library.
Original command line:
gcc dataset.o dbgmodel.o defaults.o field.o fieldlistbox.o fifomodel.o
globaldlg.o globaldlg.moc.o ... timeconvert.o utils.o \
-o ../sccmgui -Wl,-v -Wl,-no_so
-L/usr/var/tmp/swett/netcdf/lib -L/usr/var/tmp/swett/qt/lib -lqt
-lnetcdf -L/usr/var/tmp/swett/ncarg/lib -lncarg -lncarg_gks -lncarg_c
-Wl,-no_archive -lfor -lots -L/usr/X11R6/lib -lX11 -lm
Verbose output from linker:
collect2 version 2.95.2 19991024 (release)
/usr/bin/ld -G 8 -O1 -call_shared -o ../sccmgui
/usr/lib/cmplrs/cc/crt0.o -L/usr/var/tmp/swett/netcdf/lib
-L/usr/var/tmp/swett/qt/lib -L/usr/var/tmp/swett/ncarg/lib
-L/usr/X11R6/lib
-L/usr/var/tmp/swett/gccdir/lib/gcc-lib/alphaev56-dec-osf4.0f/2.95.2
-L/usr/lib/cmplrs/cc -L/usr/var/tmp/swett/gccdir/lib dataset.o
dbgmodel.o defaults.o field.o fieldlistbox.o fifomodel.o globaldlg.o
globaldlg.moc.o... timeconvert.o utils.o -v -no_so -lqt -lnetcdf -lncarg
-lncarg_gks -lncarg_c -no_archive -lfor -lots -lX11 -lm -lgcc -lc -lgcc
Any thoughts/advice on this would be much appreciated.
Karin Swett
In article <865b59$pch$1@nnrp1.deja.com>,
swettk@my-deja.com wrote:
> Thanks to both for your advice.
>
> I used the -Wl,-no_so and -Wl,-no_archive and it worked
> like a charm.
>
> Karin
>
> In article <85opbb$i6n$1@news.ndsu.nodak.edu>,
> mooney@dogbert.cc.ndsu.NoDak.edu (Tim Mooney) wrote:
> > In article <85d6ah$esg$1@nnrp1.deja.com>, <swettk@my-deja.com>
wrote:
> > > I'm installing software on osf1 v4.0 that requires some libraries
to
> be
> > > linked statically and others dynamically. On other platforms
(SunOS,
> > > LINUX, and IRIX), I have successfully used the -Wl,-Bstatic and
> > > -Wl,Bdynamic flags, but these flags are unrecognized on this
> platform.
> >
> > -Wl says "pass the following option to the linker". Tru64's linker
> doesn't
> > grok `-Bstatic' or `-Bdynamic'. It does grok things like
> `-non_shared',
> > `-no_so', et. al. See the `ld' man page. You probably need
multiple
> > occurrences of `-no_so' and `-no_archive' to arrange to have just
> certain
> > library linked in statically. Tru64's linker doesn't have
> (unfortunately)
> > a `-prefer_static' or `-archive_shared' option, a la HP-UX's linker.
> You
> > may also need to pay special attention to the `-oldstyle_liblookup'
> flag.
> >
> > gcc and g++ have their own options to indicate you want to do static
> or shared
> > linking. See the gcc info node for "Link Options". Passing (e.g.)
> -static
> > to the compiler causes it to pass the appropriate flags to the
linker
> for
> > the platform it's on.
> >
> > If you're using gcc 2.95.1, I ran into what I think is a bug with
how
> gcc
> > passes options to programs it invokes on your behalf (such as ld).
I
> don't
> > know if that's been fixed in 2.95.2, but it caused some arguments to
> not
> > be passed on correctly.
> >
> > Tim
> >
> > > Thanks in advance,
> > > Karin
> > --
> > Tim Mooney
> mooney@dogbert.cc.ndsu.NoDak.edu
> > Information Technology Services (701) 231-1076 (Voice)
> > Room 242-J1, IACC Building (701) 231-8541 (Fax)
> > North Dakota State University, Fargo, ND 58105-5164
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
next prev parent reply other threads:[~2000-02-17 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-10 5:00 Linking Statically & Dynamically with GCC swettk
2000-01-13 5:00 ` Joe Mario
2000-01-15 5:00 ` Tim Mooney
2000-01-19 5:00 ` swettk
2000-02-17 5:00 ` swettk [this message]
2000-02-17 5:00 ` swettk
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox