Message ID | 20211026124437.3301773-1-richard.purdie@linuxfoundation.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 896D03858410 for <patchwork@sourceware.org>; Tue, 26 Oct 2021 12:45:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 896D03858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635252309; bh=qzxmMfrJ/GYd+3YrHBpbWfU80hEFQgvxRw4RvZ1nHtE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=nqwkCii/QcVW/uuFkaiPe3oD8GX+2EGelJfDVBiKHLoeeCkY+K2GP7DRGnZ9kzS99 noKLHdYxNRi+oAz3WX3QbDErntV76Vlbal1ccUGCCkktwm6IFF/8vZzJd8Jrm4LKYI FNkf1F+qy/857TpgW+z8Bk6mN7emyr9Gn8kPvD4k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id D5A753858403 for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 12:44:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5A753858403 Received: by mail-wm1-x331.google.com with SMTP id y78so8718900wmc.0 for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 05:44:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=qzxmMfrJ/GYd+3YrHBpbWfU80hEFQgvxRw4RvZ1nHtE=; b=Qjcgut2MyFzi0JWMJGuJH9nwimYJRjCp07/TOMY96yiZok1yMuQvaoGUN5Z2P0ZNRx 6jJUcQPQcUQwdEIrfVm0YeFjqXRaKiekjU3YaEh95vK8Km+aOwq41+ajatZYeEX2tZjM IlvQ2ZXvbNuD4I6QfX/V6WQHwPwsFxxZeb17rmbE9qOCm8Dr5suIq0BfFgHk/MoRIfDo 3AVKJTonYhnBJx3+5HvI9PtMAy3yzeEXooy51zJmi4nZ35A8psdkAjpewK4RjkKCyYQ7 ubs+mcEGqTLi8gI4CMQhfF+ZSecxshL5b2KNsPtr0sxlYfiCTmv9EcNKY5JY1Ei5sXEW cnNg== X-Gm-Message-State: AOAM532emn0njMhaOR4ITRfv1H4YpIhFbDtaTXAheCZ7mx7X6219d1jy AnjH6RQ1G0H19ekbwIqbjkMqmGwexwbYDw== X-Google-Smtp-Source: ABdhPJyXXyfX1Ei5If8MNZxJ/EFWxOUR1UZiJt7lynx5Xlfy36w4mh+KVaWGU+pvdWJJ7VksKalVLQ== X-Received: by 2002:a05:600c:4fc5:: with SMTP id o5mr6061365wmq.147.1635252278417; Tue, 26 Oct 2021 05:44:38 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:6b9e:385e:1583:4f40]) by smtp.gmail.com with ESMTPSA id n68sm496146wmn.13.2021.10.26.05.44.38 for <gcc-patches@gcc.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 05:44:38 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/4] Makefile.in: Ensure build CPP is used for build targets Date: Tue, 26 Oct 2021 13:44:34 +0100 Message-Id: <20211026124437.3301773-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Richard Purdie via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Richard Purdie <richard.purdie@linuxfoundation.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[1/4] Makefile.in: Ensure build CPP is used for build targets
|
|
Commit Message
Richard Purdie
Oct. 26, 2021, 12:44 p.m. UTC
During cross compiling, CPP is being set to the target compiler even for
build targets. As an example, when building a cross compiler targetting
mingw, the config.log for libiberty in
build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log
shows:
configure:3786: checking how to run the C preprocessor
configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32
configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
configure:3876: $? = 0
This is libiberty being built for the build environment, not the target one
(i.e. in build-x86_64-linux). As such it should be using the build environment's
gcc and not the target one. In the mingw case the system headers are quite
different leading to build failures related to not being able to include a
process.h file for pem-unix.c.
Fix this by using CC_FOR_BUILD instead of CC. Ultimately a CPP_FOR_BUILD
could be defined but CC_FOR_BUILD seems at least more correct and is a simpler
fix.
2021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
Changelog:
* Makefile.in: Use CC_FOR_BUILD as CPP for build targets
to avoid host/target contamination
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
Makefile.in | 1 +
1 file changed, 1 insertion(+)
Comments
On Tue, Oct 26, 2021 at 2:45 PM Richard Purdie via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > During cross compiling, CPP is being set to the target compiler even for > build targets. As an example, when building a cross compiler targetting > mingw, the config.log for libiberty in > build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log > shows: > > configure:3786: checking how to run the C preprocessor > configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 > configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c > configure:3876: $? = 0 > > This is libiberty being built for the build environment, not the target one > (i.e. in build-x86_64-linux). As such it should be using the build environment's > gcc and not the target one. In the mingw case the system headers are quite > different leading to build failures related to not being able to include a > process.h file for pem-unix.c. > > Fix this by using CC_FOR_BUILD instead of CC. Ultimately a CPP_FOR_BUILD > could be defined but CC_FOR_BUILD seems at least more correct and is a simpler > fix. Since we're using AC_PROG_CPP to find the preprocessor simply assuming that $(CC_FOR_BUILD) -E works looks dangerous? > 2021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org> > > Changelog: > > * Makefile.in: Use CC_FOR_BUILD as CPP for build targets > to avoid host/target contamination > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > Makefile.in | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Makefile.in b/Makefile.in > index 34b2d89660d..f4815d7e75f 100644 > --- a/Makefile.in > +++ b/Makefile.in > @@ -152,6 +152,7 @@ BUILD_EXPORTS = \ > AR="$(AR_FOR_BUILD)"; export AR; \ > AS="$(AS_FOR_BUILD)"; export AS; \ > CC="$(CC_FOR_BUILD)"; export CC; \ > + CPP="$(CC_FOR_BUILD) -E"; export CPP; \ > CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ > CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ > CXX="$(CXX_FOR_BUILD)"; export CXX; \ > -- > 2.32.0 >
On Tue, 2021-10-26 at 14:55 +0200, Richard Biener wrote: > On Tue, Oct 26, 2021 at 2:45 PM Richard Purdie via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > > > During cross compiling, CPP is being set to the target compiler even for > > build targets. As an example, when building a cross compiler targetting > > mingw, the config.log for libiberty in > > build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log > > shows: > > > > configure:3786: checking how to run the C preprocessor > > configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 > > configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c > > configure:3876: $? = 0 > > > > This is libiberty being built for the build environment, not the target one > > (i.e. in build-x86_64-linux). As such it should be using the build environment's > > gcc and not the target one. In the mingw case the system headers are quite > > different leading to build failures related to not being able to include a > > process.h file for pem-unix.c. > > > > Fix this by using CC_FOR_BUILD instead of CC. Ultimately a CPP_FOR_BUILD > > could be defined but CC_FOR_BUILD seems at least more correct and is a simpler > > fix. > > Since we're using AC_PROG_CPP to find the preprocessor simply assuming > that $(CC_FOR_BUILD) -E works looks dangerous? Potentially, yes. So the route of adding CPP_FOR_BUILD would be preferred? Cheers, Richard
On Tue, Oct 26, 2021 at 2:57 PM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > On Tue, 2021-10-26 at 14:55 +0200, Richard Biener wrote: > > On Tue, Oct 26, 2021 at 2:45 PM Richard Purdie via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > > > > > > During cross compiling, CPP is being set to the target compiler even for > > > build targets. As an example, when building a cross compiler targetting > > > mingw, the config.log for libiberty in > > > build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log > > > shows: > > > > > > configure:3786: checking how to run the C preprocessor > > > configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 > > > configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c > > > configure:3876: $? = 0 > > > > > > This is libiberty being built for the build environment, not the target one > > > (i.e. in build-x86_64-linux). As such it should be using the build environment's > > > gcc and not the target one. In the mingw case the system headers are quite > > > different leading to build failures related to not being able to include a > > > process.h file for pem-unix.c. > > > > > > Fix this by using CC_FOR_BUILD instead of CC. Ultimately a CPP_FOR_BUILD > > > could be defined but CC_FOR_BUILD seems at least more correct and is a simpler > > > fix. > > > > Since we're using AC_PROG_CPP to find the preprocessor simply assuming > > that $(CC_FOR_BUILD) -E works looks dangerous? > > Potentially, yes. So the route of adding CPP_FOR_BUILD would be preferred? I would say so, yes. Richard. > > Cheers, > > Richard >
diff --git a/Makefile.in b/Makefile.in index 34b2d89660d..f4815d7e75f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -152,6 +152,7 @@ BUILD_EXPORTS = \ AR="$(AR_FOR_BUILD)"; export AR; \ AS="$(AS_FOR_BUILD)"; export AS; \ CC="$(CC_FOR_BUILD)"; export CC; \ + CPP="$(CC_FOR_BUILD) -E"; export CPP; \ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CXX="$(CXX_FOR_BUILD)"; export CXX; \