public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags
@ 2008-04-14  8:25 Ludovic Courtès
  2008-04-14 18:03 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2008-04-14  8:25 UTC (permalink / raw)
  To: gcc-help

Hi,

NixOS (http://nixos.org/) is a distribution where packages are always
installed in so-called "non-standard" locations (to give you an idea, it
has no `/lib' and the only file in `/bin' is `sh'  :-)).

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?

Thanks,
Ludovic.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags
  2008-04-14  8:25 Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags Ludovic Courtès
@ 2008-04-14 18:03 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2008-04-14 18:03 UTC (permalink / raw)
  To: gcc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-14 12:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14  8:25 Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags Ludovic Courtès
2008-04-14 18:03 ` Ludovic Courtès

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).