From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mengyan1223.wang (mengyan1223.wang [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 343183858D20 for ; Tue, 15 Mar 2022 07:19:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 343183858D20 Received: from [IPv6:240e:358:11a2:6700:dc73:854d:832e:3] (unknown [IPv6:240e:358:11a2:6700:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@mengyan1223.wang) by mengyan1223.wang (Postfix) with ESMTPSA id 0096B65F69; Tue, 15 Mar 2022 03:19:16 -0400 (EDT) Message-ID: <344e771c8f8317ad4ee6994db89cba1779df149f.camel@mengyan1223.wang> Subject: Re: Compile GCC using only tools isolated from host environment From: Xi Ruoyao To: Benjamin Lovy , gcc-help@gcc.gnu.org Date: Tue, 15 Mar 2022 15:19:09 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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, 15 Mar 2022 07:19:22 -0000 On Mon, 2022-03-14 at 18:43 -0400, Benjamin Lovy wrote: /* snip */ > Now, I would like to build a fresh GCC using the previously build GCC, > this > glib, and the GMP/MPC/MPFR libraries I just built: > > /build/gcc-11.2.0/configure \ > CFLAGS="-Wl,-dynamic-linker=/lib/ld-linux-x86-64.so.2 -Wl,-rpath,/lib > -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include -I/usr/include > -I/usr/include/linux -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include- > fixed > -B/bin" \ I think these FLAGS are mistaken. --sysroot won't expand -I/usr/include to search $SYSROOT/usr/include for example. And, Without "-O2" your GCC will be built without optimization, which will make a stupidly slow compiler. >   --prefix=/bootstrap/gcc \ > --host=x86_64-pc-linux-gnu \ > --with-sysroot=/bootstrap \ You need --with-build-sysroot instead of --with-sysroot. Read https://gcc.gnu.org/install/configure.html for their difference. Please note --sysroot is mostly for cross-compilation. If you are not building a GCC which is meant to run in a new OS tree (chroot or container, or even reboot into a new OS tree), it's likely you shouldn't use sysroot at all. -- Xi Ruoyao School of Aerospace Science and Technology, Xidian University