From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C2D881F5A0 for ; Sat, 4 Feb 2023 23:46:55 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=gF5MGoTC; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B6B338582B7 for ; Sat, 4 Feb 2023 23:46:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B6B338582B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675554413; bh=ldZU9iceZJGj9KP86ooWs/b1mncFBva9u4ga9XcxrIA=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gF5MGoTCyb6+DKiryASfHJQNlX+b4auQB+XXbXfurClt3MlWs1vljF9iRFGtdjlZZ 9s5JtC48thiAIRp0DXW6PtGdDNtg8VCrPwZq2X0Wb+PaoxqYUrV14r5px2rDpwBQCG RenpA1Qpriwn6Z6eeZd2QRZKjU776Ld9EYKdx4lE= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EA6283858C52 for ; Sat, 4 Feb 2023 23:46:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA6283858C52 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-510-VOrBzcjAPtWhtZjk6pg1yQ-1; Sat, 04 Feb 2023 18:46:29 -0500 X-MC-Unique: VOrBzcjAPtWhtZjk6pg1yQ-1 Received: by mail-il1-f198.google.com with SMTP id i7-20020a056e021b0700b003033a763270so5696107ilv.19 for ; Sat, 04 Feb 2023 15:46:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ldZU9iceZJGj9KP86ooWs/b1mncFBva9u4ga9XcxrIA=; b=gkG/4CXZ7TGLW1imLWhm8huEKdcOvCHps0RD2FKqrRFbMH+vGE2z+pioAJa4eJ0OEV YR7JfAQhdQJWKWGfkF7TzDAKTpjp6zN94EW48z5k74mbkemONdpWTAX4HymVmEfShnsR 8i8+zUhXaUgNVmjBWAMNauYoKCj9cEGPQChpBC+9S5inh8bMj20XzMo6p3xhbxU3UdF7 NgN76VeUO6PvphwfEuEd0WkrdtKsksZyxf3jSa5rSxPvCWdhJO1FegnL3oIqrlvOvGTO J1p/ekin8she0rOOb2j2kasLKMRYhmRvwlRY4Q6JERXcJBqd2R3iYBgBD5A/dwjK3F35 w2bw== X-Gm-Message-State: AO0yUKXHShexv30+MonJH3qDBqmmwzcTZLUiKhQegOngMSTByZDfoR5U E6/huHT7WW5QfHGgYplYg6NiQdz+8XJNtFZ0/GGLc/pB24N3lr6On9EAIUpDMCob1+WNG6EBAUu 9yrBxLp2QGNMTOkhXMct9 X-Received: by 2002:a6b:6f13:0:b0:71a:1b72:5afc with SMTP id k19-20020a6b6f13000000b0071a1b725afcmr13057436ioc.19.1675554388133; Sat, 04 Feb 2023 15:46:28 -0800 (PST) X-Google-Smtp-Source: AK7set9yW6Yem/7I2o56K24hKQY/CE6HdZFhU9O41XGI25r1D2Fs6Ml1JB62PNgZ5j41jpuqAJyqnQ== X-Received: by 2002:a6b:6f13:0:b0:71a:1b72:5afc with SMTP id k19-20020a6b6f13000000b0071a1b725afcmr13057428ioc.19.1675554387874; Sat, 04 Feb 2023 15:46:27 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id o6-20020a02b806000000b003af2cdde559sm2097699jam.35.2023.02.04.15.46.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Feb 2023 15:46:26 -0800 (PST) Message-ID: <3f53d014-9788-d773-8bb4-e87b013e1e10@redhat.com> Date: Sat, 4 Feb 2023 18:46:25 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] configure.ac: fix include header discovery on gcc-12 [BZ #28183] To: Sergei Trofimovich , libc-alpha@sourceware.org References: <20210804103739.2755644-1-slyfox@gentoo.org> Organization: Red Hat In-Reply-To: <20210804103739.2755644-1-slyfox@gentoo.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 8/4/21 06:37, Sergei Trofimovich via Libc-alpha wrote: > In https://gcc.gnu.org/PR101305 gcc introduced ABI-specific > internal `include` include directory: > > gcc-12: > /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/32/include > /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include > gcc-11: > /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include This patch is technically correct IMO, but as-of today there isn't anything in that path that actually impacts a glibc build with gcc 12. I cannot reproduce the error that you quote below and I've tried a variety of configurations using Fedora gcc 12. I would accept this patch for master, but it needs a rebase and I will review and ACK the rebase because I agree that from first-principles we may want that extra path in the future. Please rebase and post and TO me. > > glibc's build system tries to extract only one of them and fails > the build for 32-bit ABI on x86_64: > > ../glibc/configure \ > --prefix=/usr \ > --build=x86_64-pc-linux-gnu \ > --host=i686-pc-linux-gnu \ > --with-headers=/usr/include \ > CC='x86_64-pc-linux-gnu-gcc -m32' \ > CXX='x86_64-pc-linux-gnu-g++ -m32' && > make > > python3 -B ../scripts/gen-as-const.py ... > :1:10: fatal error: stddef.h: No such file or directory > > To workaround the failure we extend `configure.ac` to also > lookup `stddef.h` include directory and add it as a lower priority > search path. > > Signed-off-by: Sergei Trofimovich > --- > configure | 37 ++++++++++++++++++++++++++++++++++--- > configure.ac | 15 ++++++++++++--- > 2 files changed, 46 insertions(+), 6 deletions(-) > > diff --git a/configure b/configure > index 9619c10991..cac124f346 100755 > --- a/configure > +++ b/configure > @@ -5452,15 +5452,46 @@ $as_echo "$as_me: WARNING: > *** some features or tests will be disabled. > *** Check the INSTALL file for required versions." >&2;} > > -# if using special system headers, find out the compiler's sekrit > -# header directory and add that to the list. NOTE: Only does the right > -# thing on a system that doesn't need fixincludes. (Not presently a problem.) > +# If using special system headers, find out the compiler's internal > +# header directory and add that to the list to negate -nostdinc effect. > +# NOTE: Only does the right thing on a system that doesn't need fixincludes. > +# (Not presently a problem.) > +# NOTE: sometimes 'include' is also present in gcc's ABI-specific paths > +# like in https://sourceware.org/PR28183. To avoid it we probe a known > +# 'stddef.h' header that resides in a common include directory. > if test -n "$sysheaders"; then > SYSINCLUDES=-nostdinc > for d in include include-fixed; do > i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" && > SYSINCLUDES="$SYSINCLUDES -isystem $i" > done > + for f in include/stddef.h; do > + i=`$CC -print-file-name="$f"` && test "x$i" != x && test "x$i" != "x$f" && > + d=`$as_dirname -- "$i" || > +$as_expr X"$i" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ > + X"$i" : 'X\(//\)[^/]' \| \ > + X"$i" : 'X\(//\)$' \| \ > + X"$i" : 'X\(/\)' \| . 2>/dev/null || > +$as_echo X"$i" | > + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ > + s//\1/ > + q > + } > + /^X\(\/\/\)[^/].*/{ > + s//\1/ > + q > + } > + /^X\(\/\/\)$/{ > + s//\1/ > + q > + } > + /^X\(\/\).*/{ > + s//\1/ > + q > + } > + s/.*/./; q'` && > + SYSINCLUDES="$SYSINCLUDES -isystem $d" > + done > SYSINCLUDES="$SYSINCLUDES \ > -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" > if test -n "$CXX"; then > diff --git a/configure.ac b/configure.ac > index 34ecbba540..9507a552ff 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1083,15 +1083,24 @@ test -n "$aux_missing" && AC_MSG_WARN([ > *** some features or tests will be disabled. > *** Check the INSTALL file for required versions.]) > > -# if using special system headers, find out the compiler's sekrit > -# header directory and add that to the list. NOTE: Only does the right > -# thing on a system that doesn't need fixincludes. (Not presently a problem.) > +# If using special system headers, find out the compiler's internal > +# header directory and add that to the list to negate -nostdinc effect. > +# NOTE: Only does the right thing on a system that doesn't need fixincludes. > +# (Not presently a problem.) > +# NOTE: sometimes 'include' is also present in gcc's ABI-specific paths > +# like in https://sourceware.org/PR28183. To avoid it we probe a known > +# 'stddef.h' header that resides in a common include directory. > if test -n "$sysheaders"; then > SYSINCLUDES=-nostdinc > for d in include include-fixed; do > i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" && > SYSINCLUDES="$SYSINCLUDES -isystem $i" > done > + for f in include/stddef.h; do > + i=`$CC -print-file-name="$f"` && test "x$i" != x && test "x$i" != "x$f" && > + d=`AS_DIRNAME(["$i"])` && > + SYSINCLUDES="$SYSINCLUDES -isystem $d" > + done > SYSINCLUDES="$SYSINCLUDES \ > -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" > if test -n "$CXX"; then -- Cheers, Carlos.