Fix AIX CI build break.

Message ID 20250113044351.45450-1-akamath996@gmail.com
State New
Headers
Series Fix AIX CI build break. |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Aditya Vidyadhar Kamath Jan. 13, 2025, 4:43 a.m. UTC
  From: KamathForAIX <Aditya.Kamath1@ibm.com>

In AIX a recent commit caused a build break with the error as shown below.
In file included from python/py-color.h:23,
                 from python/python.c:39:
python/python-internal.h:86:10: fatal error: Python.h: No such file or directory
   86 | #include <Python.h>

In AIX, we run builds with and without python for our internal CI's.

A feature development made by the recent commit https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6447969d0ac774b6dec0f95a0d3d27c27d158690
missed to guard Python.h in HAVE_PYTHON macro.

This commit is a fix for the same.
---
 gdb/python/python.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Tom Tromey Jan. 13, 2025, 9:08 a.m. UTC | #1
>>>>> Aditya Vidyadhar Kamath <akamath996@gmail.com> writes:

> A feature development made by the recent commit
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6447969d0ac774b6dec0f95a0d3d27c27d158690
> missed to guard Python.h in HAVE_PYTHON macro.

> This commit is a fix for the same.

Sorry about that.

> +
> +#ifdef HAVE_PYTHON
>  #include "py-color.h"
> +#endif /* HAVE_PYTHON */
 
Rather than a new #ifdef, could you just move the #include into the
already-existing #ifdef block?  Thanks.

Tom
  
Aditya Kamath Jan. 13, 2025, 10:35 a.m. UTC | #2
Hi Tom,

>Rather than a new #ifdef, could you just move the #include into the
>already-existing #ifdef block?  Thanks.

Thank you for noticing. I had missed it. I have made the change and sent a v2 of the patch requesting approval to commit.
Have a nice day ahead.

Regards,
Aditya.

From: Tom Tromey <tom@tromey.com>
Date: Monday, 13 January 2025 at 2:38 PM
To: Aditya Vidyadhar Kamath <akamath996@gmail.com>
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, tom@tromey.com <tom@tromey.com>, gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath <Aditya.Kamath1@ibm.com>, SANGAMESH MALLAYYA <sangamesh.swamy@in.ibm.com>
Subject: [EXTERNAL] Re: [PATCH] Fix AIX CI build break.
>>>>> Aditya Vidyadhar Kamath <akamath996@gmail.com> writes:

> A feature development made by the recent commit
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6447969d0ac774b6dec0f95a0d3d27c27d158690 
> missed to guard Python.h in HAVE_PYTHON macro.

> This commit is a fix for the same.

Sorry about that.

> +
> +#ifdef HAVE_PYTHON
>  #include "py-color.h"
> +#endif /* HAVE_PYTHON */

Rather than a new #ifdef, could you just move the #include into the
already-existing #ifdef block?  Thanks.

Tom
  

Patch

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 15bb9129739..f647e6aaf4c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -36,7 +36,10 @@ 
 #include "run-on-main-thread.h"
 #include "observable.h"
 #include "build-id.h"
+
+#ifdef HAVE_PYTHON
 #include "py-color.h"
+#endif /* HAVE_PYTHON */
 
 #if GDB_SELF_TEST
 #include "gdbsupport/selftest.h"