From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 3938B3858D39 for ; Tue, 11 Jan 2022 11:19:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3938B3858D39 Received: by mail-wm1-x334.google.com with SMTP id e5so10745594wmq.1 for ; Tue, 11 Jan 2022 03:19:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3wcpXqEsEALQBAsFT4TM+Y4peDm+KFgRTE8b4acBomg=; b=gK0s75BPJ+MbHRc4bJj8h211Ojp1LzVB+PrTTCs4odJPKQdfX+Mr992ftYe4YmcVuy 9F3anIropf8nxlnIrCtLFK5a+zGjQvmEqhxrJwqSX9rivvaTmw+xRRaH+2G2jpwo368S pkKu5m/h8i2CW19wMeNKatW2HenMSBD4mR7ay3tpOMrAzY6GYXwLZzcGy4va+heEMYSf W8M/9dN1YhtukrDKFEthtzqp+jNbK/LYmYTR97E05HeSp7gSj5DdlMwn7W5MbYFSvERI XiUFuwu+gu35O2ngj8HOP0ffEzt/IdAOAPDT3IICX40JUxSyiNLEVivnH9Pk7lfNDE8x qTvg== X-Gm-Message-State: AOAM533GgQ5p2R34Q4o9xxZWaKvJdl7WA6YZ0OhyhVdoERaKdKPnVxeF J+dwoUusBWMgOCLYCWWgxjwgIVM6XyhiGHckzNaIyItOO5E= X-Google-Smtp-Source: ABdhPJxMc5Bspxzjq/bR9NP12SzV3yCrvbGqa6m8mqGeLM1jwtAS4gLsNyXaiIttFxt7qB/2igKs/c/0N5SoqU1eOVY= X-Received: by 2002:a05:600c:1e05:: with SMTP id ay5mr2049268wmb.131.1641899955307; Tue, 11 Jan 2022 03:19:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Tue, 11 Jan 2022 11:19:03 +0000 Message-ID: Subject: Re: [EXTERNAL] Re: Compiling GCC 11 for Windows targeting ARM on Linux To: Xi Ruoyao Cc: Thomas Sobczynski , "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jan 2022 11:19:17 -0000 On Tue, 11 Jan 2022 at 06:54, Xi Ruoyao wrote: > > On Tue, 2022-01-11 at 03:44 +0000, Thomas Sobczynski wrote: > > Update: I kept peering at the configure scripts and their embedded > > comments, and concluded that it's at least worth trying to add "-- > > with-newlib" to the configure script parameters. That may not be the > > right move, but it did get me further into the build process. However, > > although its configure script finished, the GCC build seems unable to > > compile libstdc++ (tail end of output below). > > > > Am I barking up the wrong tree with "--with-newlib"? > > I think --with-newlib is needed, as it's the de-facto C library on bare > metal ARM. But you need to install newlib for the target before > building libstdc++, because libstdc++ needs a C library. Strictly speaking it doesn't need one, but you have to use --disable-hosted-libstdcxx --without-headers --with-newlib to tell it you have no C library. On the master branch you no longer need the --with-newlib for that case (PR 103866). Building trunk, or backporting the fix for that bug to gcc-11, might make life easier. > > And your configuration may trigger > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017, which is fixed in > GCC 11 branch recently. You may need to "git pull" your GCC 11 branch > to overcome it. Yes, building a canadian cross for bare metal, involving Windows, is like falling out of the ugly tree and hitting every branch on the way down. > Maybe you can add --disable-libstdcxx and build a GCC without libstdc++, > reboot into Windows, and then compile newlib & libstdc++ for target with > the toolchain just built. > > However, honestly I don't do any serious development on Windows... > > Does it make sense that the build is supplying include search > > directories from the GCC v11 build tree (compiler being compiled) to > > the native cross compiler which is GCC v9.x? I already misunderstood > > the build/host/target config earlier. Is it perhaps not_a_ GCC cross > > toolchain that I need, but perhaps I need to build _the_ compiler > > (v11) and then turn around and use it to build for the non-native > > Host? > > "__has_builtin" is introduced in GCC 10, so GCC 9 can't recognize it. > IIRC libstdc++ from a specific GCC version is only expected to be built > with GCC with the same version. Correct.