Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Linking Statically & Dynamically with GCC
@ 2000-01-10  5:00 swettk
  2000-01-13  5:00 ` Joe Mario
  2000-01-15  5:00 ` Tim Mooney
  0 siblings, 2 replies; 6+ messages in thread
From: swettk @ 2000-01-10  5:00 UTC (permalink / raw)


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.

I need to know what flags to use on osf1 to achieve the same effect, or
if I have made some error in linking, if someone would be so kind as to
give me a clue. :)

Following is the output at the linking stage (note that I had to install
gcc locally, so libstdc++ is not in the traditional place; rather it is
in /usr/var/tmp/dec/lib):

g++ dataset.o dbgmodel.o defaults.o field.o fieldlistbox.o fifomodel.o
globaldlg.o globaldlg.moc.o globaldlgLayout.o globaldlgLayout.moc.o
history.o iopdlg.o iopdlg.moc.o iopdlgLayout.o iopdlgLayout.moc.o
loaddlg.o loaddlg.moc.o loaddlgLayout.o loaddlgLayout.moc.o main.o
mainwnd.o mainwnd.moc.o mainwndLayout.o mainwndLayout.moc.o manager.o
map.o model.o msgdlg.o ncarg.o ncarg_stubs.o ncfile.o optiondlg.o
optiondlg.moc.o plist.o plist.moc.o plistLayout.o plistLayout.moc.o
plot.o plot.moc.o plotLayout.o plotLayout.moc.o plotwnd.o plotwnd.moc.o
postdlg.o postdlg.moc.o postdlgLayout.o postdlgLayout.moc.o rpcmodel.o
scaledlg.o scaledlg.moc.o scaledlgLayout.o scaledlgLayout.moc.o
sicfile.o timeconvert.o utils.o  \
          -o ../sccmgui -Wl,-Bstatic -L/usr/var/tmp/dec/lib  -lstdc++
-L/usr/local/lib -L/usr/var/tmp/dec/qt/lib -lqt -lnetcdf
-L/usr/local/lib  -lncarg -lncarg_gks -lncarg_c -Wl,-Bdynamic -lfor
-lots -L/usr/X11R6/lib -lX11 -lm
/usr/bin/ld:
Can't locate file for: -lstdc++ with -Bstatic
collect2: ld returned 1 exit status
make: *** [../sccmgui] Error 1


Thanks in advance,
Karin




Sent via Deja.com http://www.deja.com/
Before you buy.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Linking Statically & Dynamically with GCC
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Mario @ 2000-01-13  5:00 UTC (permalink / raw)


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.
>
> I need to know what flags to use on osf1 to achieve the same effect, or
> if I have made some error in linking, if someone would be so kind as to
> give me a clue. :)

The following three flags are the supported equivalents on Tru64 UNIX for
the Bstatic and
Bdynamic flags.  This is from the ld manpage.

-no_archive
   Require -l references to resolve to shared objects. Normally, if the
   shared object as specified by the -l is not found, the linker attempts
   to find the corresponding archive to resolve undefined symbols.  This
   option disallows using those archives. Note that this option is posi-
   tional and can be used more than once on a command line.  It affects
   only those options that follow it, and it is turned off by the next
   occurrence of a -no_so or -so_archive option.

-no_so
   Require -l references to resolve to archive libraries. Note that this
   option is positional and can be used more than once on a command line.
   It affects only those options that follow it, and it is turned off by
   the next occurrence of a -no_archive or -so_archive option.

-so_archive
   Turn off either the -no_archive or -no_so options allowing -l refer-
   ences to resolve to either shared objects or archive libraries in
   shared or call_shared links.

Joe Mario




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Linking Statically & Dynamically with GCC
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Tim Mooney @ 2000-01-15  5:00 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Linking Statically & Dynamically with GCC
  2000-01-15  5:00 ` Tim Mooney
@ 2000-01-19  5:00   ` swettk
  2000-02-17  5:00     ` swettk
  2000-02-17  5:00     ` swettk
  0 siblings, 2 replies; 6+ messages in thread
From: swettk @ 2000-01-19  5:00 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Linking Statically & Dynamically with GCC
  2000-01-19  5:00   ` swettk
  2000-02-17  5:00     ` swettk
@ 2000-02-17  5:00     ` swettk
  1 sibling, 0 replies; 6+ messages in thread
From: swettk @ 2000-02-17  5:00 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Linking Statically & Dynamically with GCC
  2000-01-19  5:00   ` swettk
@ 2000-02-17  5:00     ` swettk
  2000-02-17  5:00     ` swettk
  1 sibling, 0 replies; 6+ messages in thread
From: swettk @ 2000-02-17  5:00 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-02-17  5:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2000-02-17  5:00     ` swettk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox