From: ludo@gnu.org (Ludovic Courtès)
To: gcc-help@gcc.gnu.org
Subject: Re: Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags
Date: Mon, 14 Apr 2008 18:03:00 -0000 [thread overview]
Message-ID: <87d4os63vh.fsf@gnu.org> (raw)
In-Reply-To: <8763ultvy5.fsf@gnu.org>
Hi,
ludo@gnu.org (Ludovic Courtès) writes:
> Thus, when building GCC, `-B' and `-isystem' flags must be passed so
> that it finds the libc headers, as well as a `-Wl,-dynamic-linker' flag
> to pass the path to the dynamic linker. However, none of the
> environment variables supposedly honored by `configure' seem to suffice
> to propagate these flags through all the GCC build tree and all the
> build stages (currently, NixOS GCC builds circumvent this problems by
> hacking around Makefiles).
>
> What's the recommended way to achieve this?
FWIW, I solved it by passing various environment variables, either at
`configure' time, at `make' time, or both. Namely:
1. I passed `CFLAGS_FOR_BUILD' and `LDFLAGS_FOR_BUILD' with the
relevant `-B', `-isystem' and `-Wl,-dynamic-linker' flags to the
top-level `configure'.
2. I then ran `make' with
make BOOT_LDFLAGS="-B/path/to/libc/lib \
-Wl,-dynamic-linker=/path/to/libc/lib/ld-linux.so.2" \
C_INCLUDE_PATH="$PWD/prev-gcc/include:$PWD/prev-gcc/include-fixed:/path/to/libc/include" \
CPPFLAGS="-DSSIZE_MAX=LONG_MAX"
Not all parts of the build require these flags, but it doesn't hurt
to pass them from the beginning. The `CPPFLAGS' setting works
around the fact that GCC ended up using its own <limits.h> (under
`prev-gcc/include-fixed'), which doesn't define `SSIZE_MAX'.
This is somewhat kludgey and inconvenient, maybe redundant, but I
couldn't find any better way.
One complication is that some environment variables are captured and
substituted by `config.status', while others are only read by makefiles
(and sometimes then captured by a sub-`configure'), making step (2)
above unavoidable.
Thanks,
Ludovic.
prev parent reply other threads:[~2008-04-14 12:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-14 8:25 Ludovic Courtès
2008-04-14 18:03 ` Ludovic Courtès [this message]
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=87d4os63vh.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=gcc-help@gcc.gnu.org \
/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).