From patchwork Wed Jan 15 14:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 37393 Received: (qmail 62310 invoked by alias); 15 Jan 2020 14:41:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 62286 invoked by uid 89); 15 Jan 2020 14:41:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=foreign X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Jan 2020 14:41:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579099303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hPwgRnrI5/0Ps3MVG1qVZofMSZAPKLBV37Xi2AJ8V5w=; b=hKRLET1K3Ev3/m2ildN0GkwVOod8SlQ1FyidFXUTASgdQnJADxjEiqthZ2c1y8sV8dxZDY HOa7TULL13goWmpsDLIiHO1RiTQubJl5nykDkyoAJYeDsKoUMrsPFYSl1VdbJxeEzg7RzC 1PhfpMnhe0dT61KxQkQA3LHMr4SHE1I= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-OxRdXnAqMdC2gF90dlnD2g-1; Wed, 15 Jan 2020 09:41:41 -0500 Received: by mail-wm1-f71.google.com with SMTP id h130so18828wme.7 for ; Wed, 15 Jan 2020 06:41:41 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id e8sm24930942wrt.7.2020.01.15.06.41.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jan 2020 06:41:39 -0800 (PST) Subject: Re: [PATCH v2 0/6] Move gdbsupport to top level To: Tom Tromey , gdb-patches@sourceware.org References: <20200109005807.7314-1-tom@tromey.com> From: Pedro Alves Message-ID: <8a8de6a9-37b8-cad3-c818-be903037fe48@redhat.com> Date: Wed, 15 Jan 2020 14:41:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 On 1/15/20 2:09 PM, Pedro Alves wrote: > So it seems like the issue is that that '#include ' picks up > bfd's config.h instead of gnulib's by mistake. I guess that this problem doesn't trigger in the gdb dir because there we generate config.h under that exact name so gnulib's libc-config.h ends up picking gdb's config.h instead of gnulib.c and that ends up harmless. In gdbsupport, the config.h file is really named support-config.h, so that '#include ' in libc-config.h doesn't pick it like it would if it had the conventional config.h name. gnulib's config.h is generated under build/gnulib/ directly, so adding that to the include path fixes it for me. Don't know what I think of gnulib headers including . Maybe we should rename gdb's config.h to gdb-config.h too. From e212b0a4e5d332ddcc4ea12ce51481a3bf90ef34 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 15 Jan 2020 14:12:43 +0000 Subject: [PATCH] Fix gdbsupport build I'm seeing this on F27 (a clean build from scratch): ~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport' CC gdb_tilde_expand.o In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0, from ../gnulib/import/glob.h:544, from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22: ../bfd/config.h:7:4: error: #error config.h must be #included before system headers # error config.h must be #included before system headers ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ libc-config.h, where it includes config.h, says: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* This is intended to be a good-enough substitute for glibc system macros like those defined in , so that Gnulib code shared with glibc can do this as the first #include: #ifndef _LIBC # include #endif When compiled as part of glibc this is a no-op; when compiled as part of Gnulib this includes Gnulib's and defines macros that glibc library code would normally assume. */ #include ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The issue is that that '#include ' picks up bfd's config.h instead of gnulib's. I guess that this problem doesn't trigger in the gdb dir because there we generate config.h under that exact name so gnulib's libc-config.h ends up picking gdb's config.h instead of gnulib.c and that ends up harmless. In gdbsupport, the config.h file is really named support-config.h, so that '#include ' in libc-config.h doesn't pick it like it would if it had the conventional config.h name. gnulib's config.h is generated under build/gnulib/ directly, so adding that to the include path fixes it for me. gdbsupport/ChangeLog: yyyy-mm-dd Pedro Alves * Makefile.am (AM_CPPFLAGS): Add -I../gnulib. * Makefile.in: Regenerate. --- gdbsupport/Makefile.am | 2 +- gdbsupport/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) base-commit: aad09917e04b33da463f1703aab8d057cfe3f54e diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am index 1a001a00817..fdf376b2e12 100644 --- a/gdbsupport/Makefile.am +++ b/gdbsupport/Makefile.am @@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = no-dist foreign ACLOCAL_AMFLAGS = -I . -I ../config AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \ - -I../gnulib/import -I$(srcdir)/../gnulib/import \ + -I../gnulib -I../gnulib/import -I$(srcdir)/../gnulib/import \ -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd override CC := $(CXX) diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in index 5723ae5e97e..c3e6b744ec0 100644 --- a/gdbsupport/Makefile.in +++ b/gdbsupport/Makefile.in @@ -347,7 +347,7 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = no-dist foreign ACLOCAL_AMFLAGS = -I . -I ../config AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \ - -I../gnulib/import -I$(srcdir)/../gnulib/import \ + -I../gnulib -I../gnulib/import -I$(srcdir)/../gnulib/import \ -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd noinst_LIBRARIES = libgdbsupport.a