From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 67D283858D39 for ; Tue, 11 Jan 2022 11:14:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 67D283858D39 Received: by mail-wm1-x32c.google.com with SMTP id q9-20020a7bce89000000b00349e697f2fbso592274wmj.0 for ; Tue, 11 Jan 2022 03:14:26 -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:content-transfer-encoding; bh=2tH8CIVMrmH/bZV9nSHzVlGnQa9BDR5K1AtZNSBVBrI=; b=dXrXTTR0ZQ/vuY5FAWnSIWlblkFTQHnDJiPuGwkCUds7wr+p/HbhP3T/5xe3tNW7Vq 9eBGcOTJhb9EfdJ5b2BfNV2G1IdG+5fT1WAoqsHAdA4C9ZwTAENuJoWlHRvMCG0Z305a m7pHuMRNmbI0l9CTETc5xkHjrYONmBHDifAUcAlpUB9Tpf7fRQoQlg+iKHIpN9X5h6Dg /R+Btlhvfo8fV6+TZVw+CcUacRG2luDh7WAXGR9MS8KsPeyCQV0RaIEZM803nnCskJcn 81j0Ajgius5YClDFZ8mmlCJCy79cYqZmjCFSiMWMEl2e+CaieN1XEzNhDsG4OsInnBnk 7cxw== X-Gm-Message-State: AOAM53314fNJpF7VEu6nklNFcn5sza0q6LaOzB38VzmDr+liadD1BZxh BvWlsEpLk+CtUxrFyJB2pKaIlTZqaPJroNNfVcAerWLZ3s0= X-Google-Smtp-Source: ABdhPJwUqPNq6L/2IRPoWJ1Vpu7G1daQI+uTdrZXFEqGYlh3qCei2V3CHLNK5kdrprpUTCuIU0FFJsslA+83pWe0SJE= X-Received: by 2002:a1c:9856:: with SMTP id a83mr2012574wme.157.1641899665547; Tue, 11 Jan 2022 03:14:25 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Tue, 11 Jan 2022 11:14:13 +0000 Message-ID: Subject: Re: [EXTERNAL] Re: Compiling GCC 11 for Windows targeting ARM on Linux To: Thomas Sobczynski Cc: Xi Ruoyao , "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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:14:28 -0000 On Tue, 11 Jan 2022 at 03:45, Thomas Sobczynski via Gcc-help wrote: > > Update: I kept peering at the configure scripts and their embedded commen= ts, 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 di= d get me further into the build process. However, although its configure sc= ript finished, the GCC build seems unable to compile libstdc++ (tail end of= output below). > > Am I barking up the wrong tree with "--with-newlib"? > > 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? Yes. You are compiling the libstdc++ from GCC 11, so it has to look at the headers for the GCC 11 version of libstdc++. You can't use GCC 9 to compile libstdc++ from GCC 11, because GCC 9 doesn't support all the C++ features used in the GCC 11 lirbary (this is nothing to do with cross compilation, you can never use a mismatching version of GCC, newer or older, to compile libstdc++, it just doesn't usually happen unless cross compiling like this). You need a newer arm cross compiler (ideally it should exactly match the version of GCC you are trying to build). > I already misunderstood the build/host/target config earlier. Is it perha= ps not _a_ GCC cross toolchain that I need, but perhaps I need to build _th= e_ compiler (v11) and then turn around and use it to build for the non-nati= ve Host? No. This might help, it's a script I used last week to build a build!=3Dhost compiler. You'll need to adjust the flags for your own case: #!/bin/bash gcc_common_args=3D'--enable-languages=3Dc++ --disable-nls --without-isl --disable-libcc1 --disable-libgomp --disable-libsanitizer --disable-libitm --without-lto --disable-multilib' # Native GCC compiler mkdir -p ~/build-canada/gcc-native cd ~/build-canada/gcc-native $skip1 ~/src/gcc/configure --prefix=3D$HOME/gcc/12 $gcc_common_args --disable-bootstrap make -j10 && make install # Use the new native GCC PATH=3D$HOME/gcc/12/bin:$PATH # Cross binutils mkdir -p ~/build-canada/binutils cd ~/build-canada/binutils $skip2 ~/src/binutils-gdb/configure --prefix=3D$HOME/gcc/aarch64 --disable-gdb --disable-sim --disable-werror \ --target=3Daarch64-none-linux-gnu \ --build=3Dx86_64-pc-linux-gnu \ --with-sysroot=3D/home/iains/cross-roots/aarch64-none-linux-gnu make -j10 && make install # Cross GCC mkdir -p ~/build-canada/gcc-cross cd ~/build-canada/gcc-cross $skip3 ~/src/gcc/configure --prefix=3D$HOME/gcc/aarch64 $gcc_common_args \ --target=3Daarch64-none-linux-gnu \ --build=3Dx86_64-pc-linux-gnu \ --with-sysroot=3D/home/iains/cross-roots/aarch64-none-linux-gnu make -j10 && make install # Use new aarch64-none-linux-gnu-ld and aarc64-none-linux-gnu-g++ etc PATH=3D$PATH:$HOME/gcc/aarch64/bin # "Native cross" GCC mkdir -p ~/build-canada/gcc-native-cross cd ~/build-canada/gcc-native-cross $skip4 ~/src/gcc/configure --prefix=3D/not/going/to/install $gcc_common_arg= s \ --target=3Daarch64-none-linux-gnu \ --host=3Daarch64-none-linux-gnu \ --build=3Dx86_64-pc-linux-gnu \ --with-sysroot=3D/home/iains/cross-roots/aarch64-none-linux-gnu make -j10 #!/bin/bash