[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forcing static link of libstdc++

From: Mike Melanson
Subject: Re: Forcing static link of libstdc++
Date: Wed, 20 Sep 2006 07:14:01 -0700
User-agent: Thunderbird (X11/20060802)

Ralf Wildenhues wrote:
Hello Mike,

* Mike Melanson wrote on Tue, Sep 19, 2006 at 07:22:12PM CEST:
Is it possible to configure the autotools to force a static link of a particular libstdc++ library, ideally via an elegant solution in the file?

I'm afraid you have to be more specific.  Are you speaking about g++ and
its libstdc++ only?  Is this on GNU/Linux only (why on earth would you
want to do that there?), or maybe AIX and libstdc++.a isn't static as
you may think?  Are you using libtool?  (You are not trying to link
libstdc++.a into a shared library, are you?)

I think in general using a static libstdc++ (as shipped with GCC) is
rarely a good idea. IIRC there are or were some things that definitely did not work (but I may be wrong on this); and also there is definitely
a huge size overhead to the resulting binary.

One way to force it with g++ is to
 ./configure LDFLAGS=-static

but that may be just a bit too broad for your...

It's possible that I'm chasing after the wrong solution. This is a more specific problem:

* I have a proprietary program that I am trying to build to run on a wide variety of Linux/x86-based distributions.

* The build process links against on the build machine.

* The program fails to run on older systems that only have

* Thus, I have been seeking to statically link inside the binary. Not sure if this is the right or optimal solution, though previous versions of this same program -- using an ad-hoc Makefile solution -- took this route.

        -Mike Melanson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]