GNU bug report logs - #72669
gcc-toolchain environment variables

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: creightor <creightor@HIDDEN>; dated Fri, 16 Aug 2024 12:21:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 72669 <at> debbugs.gnu.org:


Received: (at 72669) by debbugs.gnu.org; 7 Nov 2024 14:04:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 07 09:04:49 2024
Received: from localhost ([127.0.0.1]:47604 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t937v-0000g8-8s
	for submit <at> debbugs.gnu.org; Thu, 07 Nov 2024 09:04:49 -0500
Received: from mail-ed1-f41.google.com ([209.85.208.41]:49220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tschwinge@HIDDEN>) id 1t8yi0-0005Lu-Px
 for 72669 <at> debbugs.gnu.org; Thu, 07 Nov 2024 04:21:45 -0500
Received: by mail-ed1-f41.google.com with SMTP id
 4fb4d7f45d1cf-5c95a962c2bso962001a12.2
 for <72669 <at> debbugs.gnu.org>; Thu, 07 Nov 2024 01:21:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1730971244; x=1731576044;
 darn=debbugs.gnu.org; 
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=GwbC5Q2BWLdTT0CHR1zcyYjfVgLGYwF+lmsuPnNC60Y=;
 b=xTJt5LRSTknZsvLJQgG1pYEF5LYGEaerIm39E6JUZpyEn83lIJ9Dd+mFCYF5D4HS3w
 a4PTn+e9Og4XbbNCHkrDf/5Yj3OzBZ+aJdORUH9e7zhK+6N9KJkDDtTFy5ezlhYc1Dew
 Y+HRIZWGqlqIsVPZxYgtQy0UzSAGIAq3SyX+BGWDumoQrtdlpiXazs6DLZKpzl1jpLHP
 ut40qqUIAWH4qZ067An7tW2wTEHlZGZNkdf37Z77RVsZfFl8XTfa1B8XxaWbKUyC9yI6
 ktRQDUV9Blca9LkERbhvap7WSsLMcF0n6+rxSEZMaq7oRxq5lRCniCdw2hzWrbhDK0g5
 e5Bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1730971244; x=1731576044;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=GwbC5Q2BWLdTT0CHR1zcyYjfVgLGYwF+lmsuPnNC60Y=;
 b=foSFvAazl/zYE3XwleA/C4GOZVcHWeJK8wzoT58m+mDUs4AIxCcUnhTBjYi8/MopFV
 8WIynZSQCMrm89UiBn+LSRL9etVJQ5jQRYsruk/6enOafl8fiRGCpjV30MTRJ7mhuqWC
 drmeZT+tcYEx6ahNYDcDa2Js5xz/Vya5BNbrBvo2azmZSV4EyImETVVKfkjdD5COxk37
 04Mc3YAoilcOU+uFBodJnCds7EsyWl7cDQ0g9L7q1LSz2DJmQj4C3/AAPmpB5xEeSMfl
 kfud4q47wPg/wPxzy07w0+YPfptEAtfgbQIMkKKYU+unSlL19s/3Gvdr5Al+uM4mgyoP
 iT9g==
X-Forwarded-Encrypted: i=1;
 AJvYcCXH0t2Aap3BxnkbcMtCaRYo1HSY4+Rkp1TpxT+mrZ8teKps15qQfN2VoPuFIc38q9RWGJL93A==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzQtooGVbUzvmSVtdA1zTLgURm8yzrBayKjSgPeaRo3BAcHGJ5j
 XNE6SYxBBUPnokpcIZEANeQiS27O23jB2TcFboV3rkUp2ooH8qe//tuBcz2QjKg=
X-Google-Smtp-Source: AGHT+IFt9r6kGHshc4djJXYN5OGBQF5DQZ2ILjm11dfayjVyRUvrfAhZ74vNfcStiMrmm5hgd3AMrA==
X-Received: by 2002:a17:907:968e:b0:a99:6036:90a with SMTP id
 a640c23a62f3a-a9ee74a0c4cmr24409266b.14.1730971242610; 
 Thu, 07 Nov 2024 01:20:42 -0800 (PST)
Received: from euler.schwinge.ddns.net
 (p200300c8b743ca00d37840a5117bb56d.dip0.t-ipconnect.de.
 [2003:c8:b743:ca00:d378:40a5:117b:b56d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a9ee3c906d6sm42363766b.49.2024.11.07.01.20.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 07 Nov 2024 01:20:42 -0800 (PST)
From: Thomas Schwinge <tschwinge@HIDDEN>
To: creightor@HIDDEN, 72669 <at> debbugs.gnu.org
Subject: Re: bug#72669: gcc-toolchain environment variables
In-Reply-To: <13ed42af-fd61-4e60-a119-3a4cfee4b888@HIDDEN>
References: <13ed42af-fd61-4e60-a119-3a4cfee4b888@HIDDEN>
User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Thu, 07 Nov 2024 10:20:40 +0100
Message-ID: <87a5ebz9g7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72669
X-Mailman-Approved-At: Thu, 07 Nov 2024 09:04:45 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Indeed this is a problem, when attempting to build GCC in a Guix profile
with 'gcc-toolchain' installed.  What you may do is create wrapper
binaries so that the Guix GCC's 'etc/profile' is only active if using the
Guix GCC (that is, when building your cross-GCC's compilers), but isn't
active (and therefore 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
'LIBRARY_PATH' etc. not defined) when your cross-GCC builds its target
libraries.  This means, you have to invoke the Guix GCC from outside of
the Guix profile.  Something like this:

    $ guix install -p "$GUIX_GCC" gcc-toolchain

..., and then script something like:

    rm -rf "$GUIX_GCC"_bin
    mkdir "$GUIX_GCC"_bin
    for f in "$GUIX_GCC"/bin/* "$GUIX_GCC"/sbin/*; do
      f_=$(basename "$f")
      case "$f" in
        */c++ \
        | */g++ \
        | */gcc \
        | */*-c++ \
        | */*-g++ \
        | */*-gcc )
          cat > "$GUIX_GCC"_bin/"$f_" <<EOF
    #!/bin/sh
    
    set -e
    
    d=\$(dirname "\$0")
    
    . "\$d"/../$GUIX_GCC/etc/profile
    
    "\$d"/../$f "\$@"
    EOF   
          chmod +x "$GUIX_GCC"_bin/"$f_"
          ;;
        *)
          ln -s ../"$f" "$GUIX_GCC"_bin/"$f_"
          ;;
      esac
    done

..., and instead of '"$GUIX_GCC"/bin/gcc' etc. then use
'"$GUIX_GCC"_bin/gcc' etc.


In my opinion, the Guix-profile-wide setting of these environment
variables (via Guix GCC's 'etc/profile') doesn't feel quite right -- but
I'm still new to Guix, so...




Information forwarded to bug-guix@HIDDEN:
bug#72669; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Aug 2024 12:20:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 16 08:20:15 2024
Received: from localhost ([127.0.0.1]:51831 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sevwE-0001K7-R4
	for submit <at> debbugs.gnu.org; Fri, 16 Aug 2024 08:20:15 -0400
Received: from lists.gnu.org ([209.51.188.17]:34776)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <creightor@HIDDEN>) id 1sesrk-0004Hz-Vl
 for submit <at> debbugs.gnu.org; Fri, 16 Aug 2024 05:03:25 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <creightor@HIDDEN>)
 id 1sesr8-0001zz-Tu
 for bug-guix@HIDDEN; Fri, 16 Aug 2024 05:02:47 -0400
Received: from layka.disroot.org ([178.21.23.139])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <creightor@HIDDEN>)
 id 1sesr6-0001Wc-Pd
 for bug-guix@HIDDEN; Fri, 16 Aug 2024 05:02:46 -0400
Received: from localhost (localhost [127.0.0.1])
 by disroot.org (Postfix) with ESMTP id D2D4340EBE
 for <bug-guix@HIDDEN>; Fri, 16 Aug 2024 11:02:41 +0200 (CEST)
X-Virus-Scanned: SPAM Filter at disroot.org
Received: from layka.disroot.org ([127.0.0.1])
 by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Ujdyhu8U2hzm for <bug-guix@HIDDEN>;
 Fri, 16 Aug 2024 11:02:41 +0200 (CEST)
Message-ID: <13ed42af-fd61-4e60-a119-3a4cfee4b888@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail;
 t=1723798960; bh=raZuG4fgEC/2ix9zz1uwfDp1yAjdHbZQQJa7Of50cxY=;
 h=Date:To:From:Subject;
 b=RA/kNg0vWX+r+TniQcVzLpKy/oAwy/QH5+zaWaQsAVsgGW0hfNVRGQwkN1Umt+LM0
 u1gPTPYoI1cR3piAz3HjZBNZ2RUQSQFrpDuifWgODsouQcJcSD37oe098wX3OyaNjB
 3IJYJx59mbcUTcNkMh36sJpXC1ex3n6qLFlkhP9NJyuujZlyj1LZA5l4uxVaNJfEjm
 Nu3xRMqS00E//LPUGBRIgN2SUoZsGV/2tMQBsoSrYu5sxVeqahBA/ylbZ9aDfbKHCM
 ktcfF9DhpBWO90P9AxDULtL/2U2pacm6omm1LV9QsxkuSSCrqPJ79LvJsiFIdPt0sV
 rc+We3khtEN8g==
Date: Fri, 16 Aug 2024 12:02:35 +0300
MIME-Version: 1.0
To: bug-guix@HIDDEN
Content-Language: en-US
From: creightor <creightor@HIDDEN>
Subject: gcc-toolchain environment variables
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=178.21.23.139; envelope-from=creightor@HIDDEN;
 helo=layka.disroot.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 16 Aug 2024 08:20:11 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Hi, it looks like having the C_INCLUDE_PATH and CPLUS_INCLUDE_PATH 
environment variables set by the gcc-toolchain package in a profile can 
cause issues.

For example, I have gcc-toolchain installed, compiled a cross-binutils 
for aarch64-elf and then tried to compile a gcc cross-compiler for the 
same target using those binutils.

These are the flags I used for binutils:

--target=aarch64-none-elf --disable-multilib

and for the gcc cross-compiler:

--target=aarch64-none-elf --disable-multilib --disable-bootstrap 
--enable-languages=c,c++ --without-headers --with-newlib 
--disable-hosted-libstdcxx --disable-libssp --disable-libsanitizer

 From what I understand, there should be no headers available when 
creating a cross-compiler for a freestanding platform like this.

Since these include paths were added with C_INCLUDE_PATH and 
CPLUS_INCLUDE_PATH, something like `#if __has_include(<sys/auxv.h>)` in 
gcc's libgcc/config/aarch64/cpuinfo.c evaluated to true and the rest of 
the build would fail.

Unsetting them didn't work since apparently gcc-toolchain relies on them 
set so I had these two variables unset in BASE_TARGET_EXPORTS in gcc's 
root Makefile.in which should only apply to the newly built gcc 
cross-compiler and so the build finished fine.





Acknowledgement sent to creightor <creightor@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#72669; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.