This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
AW: How to build stand-alone (statically linked) gcc?
- From: "Warlich, Christof" <christof dot warlich at siemens dot com>
- To: David Kang <dkang at isi dot edu>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 3 Aug 2015 07:42:14 +0000
- Subject: AW: How to build stand-alone (statically linked) gcc?
- Authentication-results: sourceware.org; auth=none
- References: <1584390641 dot 19967 dot 1438370268066 dot JavaMail dot root at zm dot isi dot edu>
> Is there a way to build gcc itself such that gcc doesn't need dynamic library for maximum portability?
We have a similar setup here, using Ubuntu 14.04 to build our cross toolchains. To get statically linked
binaries, we had to add
CFLAGS+=-static LDFLAGS+=-static LIBTOOLFLAGS2+=-all-static
when calling "make" for binutils
and
CFLAGS+=-static LDFLAGS+=-static
when calling "make" for gcc.
Optionally, i.e. if you also want a static gdb, you may add
LDFLAGS+=-static
when calling "make" for gdb.
Hope this helps, it does work fine here.