From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31438 invoked by alias); 14 Apr 2008 12:03:26 -0000 Received: (qmail 31425 invoked by uid 22791); 14 Apr 2008 12:03:24 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 14 Apr 2008 12:03:02 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JlNOf-00017x-AD for gcc-help@gcc.gnu.org; Mon, 14 Apr 2008 12:02:53 +0000 Received: from 193.50.110.101 ([193.50.110.101]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Apr 2008 12:02:53 +0000 Received: from ludo by 193.50.110.101 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Apr 2008 12:02:53 +0000 To: gcc-help@gcc.gnu.org From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Subject: Re: Passing `-B', `-isystem' and `-Wl,dynamic-linker' flags Date: Mon, 14 Apr 2008 18:03:00 -0000 Message-ID: <87d4os63vh.fsf@gnu.org> References: <8763ultvy5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Germinal an 216 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i686-pc-linux-gnu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg00187.txt.bz2 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 (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.