From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0B6E4385C019 for ; Wed, 11 Mar 2020 04:47:53 +0000 (GMT) Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 7F1BC1E4A5; Wed, 11 Mar 2020 00:47:52 -0400 (EDT) Subject: Re: [PATCH 20/24] Allow TUI windows in Python To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20200104183410.17114-1-tom@tromey.com> <20200104183410.17114-21-tom@tromey.com> <4f60dcb3-1d6c-8660-12e0-fceea911bc10@simark.ca> <87zhcn68om.fsf@tromey.com> From: Simon Marchi Message-ID: <8864df4e-a5fa-9c67-29c3-1a25887d0fce@simark.ca> Date: Wed, 11 Mar 2020 00:47:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <87zhcn68om.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2020 04:47:53 -0000 On 2020-03-10 8:23 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> In file included from /home/smarchi/src/binutils-gdb/gdb/python/py-tui.c:24: > Simon> /home/smarchi/src/binutils-gdb/gdb/gdb_curses.h:47:10: fatal error: ncurses.h: No such file or directory > Simon> 47 | #include > Simon> | ^~~~~~~~~~~ > > Simon> So I suspect weare missing an #if/#ifdef somwhere. config.log contains: > > Simon> /* Define to 1 if you have the header file. */ > Simon> /* #undef HAVE_NCURSESW_NCURSES_H */ > > Simon> /* Define to 1 if you have the header file. */ > Simon> /* #undef HAVE_NCURSES_H */ > > Simon> /* Define to 1 if you have the header file. */ > Simon> /* #undef HAVE_NCURSES_NCURSES_H */ > > That is weird because gdb_curses.h says (I marked line 47): > > #if defined (HAVE_NCURSESW_NCURSES_H) > #include > #elif defined (HAVE_NCURSES_NCURSES_H) > #include > #elif defined (HAVE_NCURSES_H) > ---> #include > #elif defined (HAVE_CURSESX_H) > #include > #elif defined (HAVE_CURSES_H) > #include > #endif > > ... which sure looks like it is guarded by HAVE_NCURSES_H. > > I couldn't find any other code that might define HAVE_NCURSES_H. > > I don't know what's going on here :( > > Tom > Sorry for being terse earlier, I didn't have much time. I took another look, I built the file with -save-temps and inspected the .ii file. The HAVE_NCURSES_H comes from pyconfig.h, which comes from the Python installation. For example, on my Ubuntu here, it's at: /usr/include/x86_64-linux-gnu/python3.8/pyconfig.h This file tells us Python was built with ncurses, which doesn't mean the ncurses development headers are installed and available to GDB. I find it very odd that Python exposes these very generically-named macros in the global namespace. Almost any of these HAVE_FOO macros from Python could clash with our own macros. Anyway, I was able to reproduce it starting from a scratch Ubuntu 20.04 docker container, installing everything required to build GDB except the ncurses development headers. One way to fix it is to make sure "python-internal.h" is included after "gdb_curses.h", in py-tui.c. Simon