public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Avoiding libgcc_s.so dependency
@ 2004-08-02 16:32 lrtaylor
  0 siblings, 0 replies; 2+ messages in thread
From: lrtaylor @ 2004-08-02 16:32 UTC (permalink / raw)
  To: soksavik, gcc-help

You can tell GCC to statically link in libgcc with the -static-libgcc
option.  However, it sounds like your ssl library was dynamically linked
with it, so, so long as you're linking to the libcrypto.so instead of
libcrypto.a, you're going to get it's dependencies as well.  The only
way to can avoid getting its dependencies as well is to either link to
the static version, or to relink (i.e., rebuild) libcrypto.so so that it
is statically linked to its dependencies.

The linker always prefers .so files of .a files if it has a choice.  You
can tell it to only link to static libraries something like this:

gcc <blah blah blah> -static-libgcc -Wl,-B,static -lfoo -lbar
-Wl,-B,dynamic

That should work, if you're using the Solaris linker.  What will happen
is that it will link to libfoo.a and libbar.a.  If it can't find either
of them (for example, if libfoo.so exists, but not libfoo.a), it will
produce an error.  The last argument tells the linker to prefer
dynamical linking again.  That way, you will get shared versions of the
system libraries.

Does that make sense?

Thanks,
Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Stian Oksavik
Sent: Sunday, August 01, 2004 6:13 AM
To: gcc-help@gcc.gnu.org
Subject: Avoiding libgcc_s.so dependency

Howdy all,

I'm struggling with libgcc_s.so.1. It seems that pretty much any
non-trivial program I compile ends up depending on libgcc_s.so.1.
Basically, this means that I can't distribute software without also
distributing this library, which is problematic for any number of
reasons.

I've been told to just build static binaries to avoid this problem,
but this is not an option on Solaris as Sun does not include all the
libraries needed to build static libraries of most software. My goal
is to be able to build binaries that avoid dependencies on any
third-party libraries, and only depends on Sun's bundled libraries.

The current project -- and problem -- is with OpenSSH 3.8.1p1 under
Solaris 9/sparc. OpenSSH picks up libcrypto.so.1 from OpenSSL (even
though libcrypto.a also exists), and that in turn forces libgcc_s.so.1
into the equation -- no matter what combination of gcc and ld flags I
try to keep this from happening.

So, two questions:

a) What is the purpose of libgcc_s.so.1, and does this purpose
outweigh the inconvenience this library causes? (Including one machine
we could no longer log into because removing the SMCgcc package from
it disabled sshd?)

b) Is there ANY way to get rid of this dependency without building a
fully static binary?


Thanks,

-Stian

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

* Avoiding libgcc_s.so dependency
@ 2004-08-01 12:12 Stian Oksavik
  0 siblings, 0 replies; 2+ messages in thread
From: Stian Oksavik @ 2004-08-01 12:12 UTC (permalink / raw)
  To: gcc-help

Howdy all,

I'm struggling with libgcc_s.so.1. It seems that pretty much any
non-trivial program I compile ends up depending on libgcc_s.so.1.
Basically, this means that I can't distribute software without also
distributing this library, which is problematic for any number of
reasons.

I've been told to just build static binaries to avoid this problem,
but this is not an option on Solaris as Sun does not include all the
libraries needed to build static libraries of most software. My goal
is to be able to build binaries that avoid dependencies on any
third-party libraries, and only depends on Sun's bundled libraries.

The current project -- and problem -- is with OpenSSH 3.8.1p1 under
Solaris 9/sparc. OpenSSH picks up libcrypto.so.1 from OpenSSL (even
though libcrypto.a also exists), and that in turn forces libgcc_s.so.1
into the equation -- no matter what combination of gcc and ld flags I
try to keep this from happening.

So, two questions:

a) What is the purpose of libgcc_s.so.1, and does this purpose
outweigh the inconvenience this library causes? (Including one machine
we could no longer log into because removing the SMCgcc package from
it disabled sshd?)

b) Is there ANY way to get rid of this dependency without building a
fully static binary?


Thanks,

-Stian

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

end of thread, other threads:[~2004-08-02 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-02 16:32 Avoiding libgcc_s.so dependency lrtaylor
  -- strict thread matches above, loose matches on Subject: below --
2004-08-01 12:12 Stian Oksavik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).