public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Brian Dessent <brian@dessent.net>
To: John Carter <john.carter@tait.co.nz>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Building _statically linked_ crosscompiler toolchain.
Date: Fri, 08 Jun 2007 03:38:00 -0000	[thread overview]
Message-ID: <4668CF36.239D1814@dessent.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0706081358070.4980@parore.tait.co.nz>

John Carter wrote:

> People keep saying that....but never saying in what way doesn't it work or why.

http://people.redhat.com/drepper/no_static_linking.html

> a. It certainly _is_ what I want... The target system is a tiny
>     embedded device where everything _must_ be statically linked.

It's hard to guess what you want when you didn't state it in your
original message.

> b. No, it doesn't solve the problem of sharing the built toolchain
>     with my colleagues.

Right, because --disable-shared does not mean statically link against
libc, it means don't build shared libraries.

> You only need one.
> 
> libc.

If you mean that differing libc versions can be a problem when
distributing binaries, then sure.

If you mean that gcc only needs libc, then you're not using a recent
version as gmp and mpfr have been host library requirements since 4.0
for gfortran and since 4.2 (or 4.1?) for the entire compiler.

> ie. Build the biggest meanest package on the gnu planet on the oldest
> slowest, smallest disk, ram system in the company. Sigh!

You can do it with a chroot on a fast machine.  You can do it with
Xen/Vmware/etc on a fast machine.  It's usually an infrequent event that
you need to rebuild the toolchain itself.

Besides, it has nothing to do with it being gcc or being a large
package, this is the general method to achieve binary compatibility for
any package on a wide range of systems.

> Even then, looking at the libc version numbers on the latest
> greatest... I don't think that will work.

That's not true.  Glibc symbol versioning goes to farily great lengths
to assure backwards binary compatibility, so don't write it off.  But
this means only that binaries compiled against an older version of the
library work correctly with a newer version, and never the reverse.

If really want to statically link the toolchain, you can start with:

path/to/configure --foo=bar ... LDFLAGS="-static"

I just tried this on gcc trunk with a C-only non-bootstrap native and it
worked fine, but you might have to make further adjustments.  Although
even after stripping cc1 is nearly 9MB so I can't imagine that this is
very efficient memory-wise or performance-wise.

Brian

  reply	other threads:[~2007-06-08  3:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 23:54 John Carter
2007-06-08  0:19 ` David Daney
2007-06-08  1:57   ` John Carter
2007-06-08  3:42     ` David Daney
2007-06-08  0:28 ` Brian Dessent
2007-06-08  2:04   ` John Carter
     [not found]     ` <"4  6  68CF36.239D1814"@dessent.net>
2007-06-08  3:38     ` Brian Dessent [this message]
2007-06-08  4:58       ` John Carter
2007-06-08  5:28         ` Brian Dessent
2007-06-11  5:50         ` John Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4668CF36.239D1814@dessent.net \
    --to=brian@dessent.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=john.carter@tait.co.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).