From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by sourceware.org (Postfix) with ESMTPS id 86D733858D1E for ; Wed, 16 Mar 2022 16:06:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86D733858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tangram.dev Authentication-Results: sourceware.org; spf=none smtp.mailfrom=tangram.dev Received: by mail-vs1-xe29.google.com with SMTP id 62so719289vsx.0 for ; Wed, 16 Mar 2022 09:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tangram-dev.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gwvSrpRNKBDxT5UDSM8g599mmsVqJv9lynbL2LV3QUI=; b=L7aDxiQATNST/yP9q354C4UacHlHi3YVdjJQG5FUV812trdl6vBPnfDMMFj9JrrWI0 71Q1hKG1WLoKe4pavni5ga4MNE+D5d1emA17CYtBMZ5NdWkLCCkI3uYSW/CVGXyZz7Ho nNW9546giw6a0IhJjbuaChNUfoBEmT4mGRrpgLk9O2i822hjdw/jUkZVhcqF+nvPEAbQ ff6j4Qs9Xs2FZtMVQpJVSyrdg6wejZbf52Smx6H23sRwJsfOT251XdetaM+QJLKXZEdj 75a5apoNrtpB7ggLgDaNLpC26xhdPUPxKXqZHAP7iVcIiP/Vn0+Wn5sJBeqVO/08P/8z bIhA== 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=gwvSrpRNKBDxT5UDSM8g599mmsVqJv9lynbL2LV3QUI=; b=33xNtuq+09SKLDbZ8AweEn2T429djByrkgEAgXkfrOiVz6ZTvoD906Atx5iTZP3RjC 3kLYxuVn3JrsGGAE7T5dvMD8GUk6Ndm83yyuzZbYfJOvVMpycbegno/VtFLjA2/0/pKM Wx+tzC37OGq25Lg5ZiADa2lFynkPiwJrE3TPqgKkr/xjv5onCI2ULIb0t7EB+ZUMSAxM lU9jVMU57PbMOtMtxOMV+Vp20Ipf+Z1CDhRypb07nqFGz7YngrN/PZhXjNXtHO1OGwz2 wJWYRDlVLNBd4SJqrzX4qCbslTTLZLFoqx+f5Pd00qVt0zTf3G3Ws1SL6RN1kt5jg8Jp 1IGg== X-Gm-Message-State: AOAM5323uYzbxNLtN0ASZiMrN4d0Rbqjwb7UgdwW0YJfEX5thi5Bf+4y LaE/yeXjcCi+GytSnZxXaQNEz968YJgfVHZOnXCd2rqt640= X-Google-Smtp-Source: ABdhPJzQ6pDidcyu/WrnVwzTA/8mnBLRCUydQAWqFLtBcSrq8fEgJJpfmeTSoOTmgj98k5f+M+6k3eGh3oNk0pjarP0= X-Received: by 2002:a05:6102:32ca:b0:322:9d61:d012 with SMTP id o10-20020a05610232ca00b003229d61d012mr254384vss.69.1647446795782; Wed, 16 Mar 2022 09:06:35 -0700 (PDT) MIME-Version: 1.0 References: <344e771c8f8317ad4ee6994db89cba1779df149f.camel@mengyan1223.wang> In-Reply-To: <344e771c8f8317ad4ee6994db89cba1779df149f.camel@mengyan1223.wang> From: Benjamin Lovy Date: Wed, 16 Mar 2022 12:06:24 -0400 Message-ID: Subject: Re: Compile GCC using only tools isolated from host environment To: Xi Ruoyao Cc: gcc-help@gcc.gnu.org X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Wed, 16 Mar 2022 16:06:40 -0000 HI, Thank you for your suggestions. I've tried the CFLAGS with fixed paths, and am still not successful. I think I am trying to do what you describe at the end - I want to produce a GCC that only depends on artifacts found in my /bootstrap tree. If I move this whole tree to a new environment, I'd like to still be able to use this compiler to build arbitrary software. > 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. On Tue, Mar 15, 2022 at 3:19 AM Xi Ruoyao wrote: > 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 >