From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-117.mimecast.com (us-smtp-delivery-117.mimecast.com [170.10.133.117]) by sourceware.org (Postfix) with ESMTP id 9BC02385803D for ; Fri, 24 Sep 2021 01:42:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BC02385803D Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-BIyprObFMMiFBi-I_sf4XQ-1; Thu, 23 Sep 2021 21:42:26 -0400 X-MC-Unique: BIyprObFMMiFBi-I_sf4XQ-1 Received: by mail-ed1-f69.google.com with SMTP id 2-20020a508e02000000b003d871759f5dso8606207edw.10 for ; Thu, 23 Sep 2021 18:42:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=fOxYy5FdTaKQejkZeHh5O3rwb0OsjsMbSS4abIlXwmk=; b=2xNNnNqg5cwD/IJF+4IPvF+tqBj/woK0Pw/kiz8EnMfVT7tnoCWbKLgYW7iFf/p7bv CuTAcrdD3IZtQsUB5IvY6cmZhy4LRpQGgC5eCJ0hZgG6tx1QZrpuSyO6rceMTFBVLv8U hIUVp3eCOcBeV1VZyqSpBxbk0o1aROY92FxhSbdwp0CGOHoxrKnnJ0H7psw/8Nu/DN+a vbdKDFs5oxn7Snf1JdPhekXyvB5Ow9KeoGjCBhEweNBAzpkk1Qyim7wiVxS4gQHfQ36M 9EU9XPiLIlbOIenEWN+e12bmH3Nnf8XMgqc1pL9eAuFF4my/jwdeVxm26qdHFKlCqex7 0mnw== X-Gm-Message-State: AOAM530INiDPlnromYBOx526fCSoGGJSkXSYQP7l1Uc+gd+y7mSo5i+C ahpqpOVEV+bqxCbH8Ds6QrGalxef138CPKXrgMyQlbltO7GywLZGO9LMCWrS1cBNLN5TlOG/jO0 5Q1OInSyRFDU8l25coWb7DaZE8CIzyw== X-Received: by 2002:a17:906:d798:: with SMTP id pj24mr8273499ejb.1.1632447745273; Thu, 23 Sep 2021 18:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6EOnayZJiPurvIUOQ/+jPFF7hN48GDHCeBEbQ6LMRCpsO4B5J91ZMeiQ6dvwbJ2ttKAaGh2a8SJjbiKWRY4w= X-Received: by 2002:a17:906:d798:: with SMTP id pj24mr8273471ejb.1.1632447744918; Thu, 23 Sep 2021 18:42:24 -0700 (PDT) MIME-Version: 1.0 From: Oleg Smolsky Date: Thu, 23 Sep 2021 18:42:14 -0700 Message-ID: Subject: Building gcc11 with sysroot To: gcc-help X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: netskope.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Fri, 24 Sep 2021 01:42:31 -0000 Hello there! I'm trying to setup a GCC 11.2 using --with-sysroot=3D$sysroot (into which glibc is already installed). I get far enough to have `xgcc` executable (which works). The executable itself is configured to get glibc from sysroot (I did that via LDFLAGS): ``` $ ldd ./gcc/xgcc linux-vdso.so.1 (0x00007ffec27d7000) libm.so.6 =3D> /opt/sysroot/usr/lib/libm.so.6 (0x00007fc12463c000) libc.so.6 =3D> /opt/sysroot/usr/lib/libc.so.6 (0x00007fc124440000) /opt/sysroot/usr/lib/ld-linux-x86-64.so.2 =3D> /lib64/ld-linux-x86-64.so.2 (0x00007fc124718000) ``` where LDFLAGS=3D"-Wl,--dynamic-linker,$sysroot/usr/lib/ld-linux-x86-64.so.2,--rpa= th,$sysroot/usr/lib" Things break a little further down the road when building libgomp: checking whether we are cross compiling... configure: error: in `.../gcc11sr/_obj/x86_64-pc-linux-gnu/libgomp': configure: error: cannot run C compiled programs. The issue here, it seems, is the absence of LDFLAGS that I had passed to the top-level `configure` script. We can see the compiler invocation in the log: configure:3996: .../gcc11sr/_obj/./gcc/xgcc -B.../gcc11sr/_obj/./gcc/ -B/opt/gcc-11sr/x86_64-pc-linux-gnu/bin/ -B/opt/gcc-11sr/x86_64-pc-linux-gnu/lib/ -isystem /opt/gcc-11sr/x86_64-pc-linux-gnu/include -isystem /opt/gcc-11sr/x86_64-pc-linux-gnu/sys-include -o conftest -g -O2 conftest.c >&5 The compiler yields a correctly-formed executable when I take that very command line and add LDFLAGS. So, finally my question: is this the right way to build a "sysrooted" GCC? IIRC this recipe worked in the GCC7 days... Thanks in advance, Oleg.