linking with libstdc++

Joe Buck
Fri Jul 26 17:52:00 GMT 2002

> On Wed, Jul 24, 2002 at 12:25:30PM +0400, Michael Fimin wrote:
> > Does anybody tried to link statically with libstdc++ to produce shared object
> > (*.so) library?

Nathan Myers writes:
> The license does not allow you to static-link the library into
> your program.  It must be remain a shared library.

At the risk of starting an off-topic thread, I don't understand why you
believe this.  We have two sets of licenses for libraries, the LGPL and
the GPL-with-special-exception.  In either case, there are legal ways to
distribute statically linked executables even if there is proprietary
code.  There are conditions to be met, yes.  If an LGPL library is used,
there has to be a way of relinking with a newer version of the library,
but that could be met by a variety of means (for example, by distributing
proprietary parts as .o files).  But the libstdc++ license is even looser:

// As a special exception, you may use this file as part of a free software
// library without restriction.  Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.  This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

In other words, you can link it into anything, using static linking.

More information about the Libstdc++ mailing list