Bug 23252 - Gdb fails to build with Python 3.7
Summary: Gdb fails to build with Python 3.7
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 8.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-01 13:45 UTC by Paul Koning
Modified: 2018-06-09 17:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Koning 2018-06-01 13:45:51 UTC
Reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1577396

With Python 3.7, gdb fails to build because it uses internal-only function _PyImport_FixupBuiltin whose signature has changed.  

The solution is to use the inittab machinery instead to make the _gdb builtin module known to Python.
Comment 1 Sourceware Commits 2018-06-08 17:32:53 UTC
The master branch has been updated by Paul Koning <pkoning@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aeab512851bf6ed623d1c6c4305b6ce05e51a10c

commit aeab512851bf6ed623d1c6c4305b6ce05e51a10c
Author: Paul Koning <paul_koning@dell.com>
Date:   Fri Jun 8 13:26:36 2018 -0400

    Fix build issue with Python 3.7
    
    Originally reported in
    https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails
    with Python 3.7 due to references to a Python internal function whose
    declaration changed in 3.7.
    
    gdb/ChangeLog
    2018-06-08  Paul Koning  <paul_koning@dell.com>
    
    	    PR gdb/23252
    
    	    * python/python.c (do_start_initialization):
    	    Avoid call to internal Python API.
    	    (init__gdb_module): New function.
Comment 2 Paul Koning 2018-06-08 17:37:59 UTC
The patch just committed resolves this issue.
Comment 3 Pedro Alves 2018-06-08 19:09:24 UTC
Can you merge it to the 8.1 branch too, please?
Comment 4 Paul.Koning 2018-06-08 20:14:46 UTC
> On Jun 8, 2018, at 3:09 PM, palves at redhat dot com <sourceware-bugzilla@sourceware.org> wrote:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=23252
> 
> Pedro Alves <palves at redhat dot com> changed:
> 
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |palves at redhat dot com
> 
> --- Comment #3 from Pedro Alves <palves at redhat dot com> ---
> Can you merge it to the 8.1 branch too, please?

Yes, I believe so.  I don't know the branch processes; anything you can point me to?  Is it just a matter of doing a merge, or are there rules about how to track things, or how to mark them in the changelogs, or stuff like that?  I've never done this before.

	paul
Comment 5 Pedro Alves 2018-06-08 21:41:35 UTC
I shouldn't have said "merge", as we don't really do real non-fast-forward merges.

It's just a matter of applying the same patch on the branch, making sure the ChangeLog ends up as the top entry with the current day as date, and then pushing.
Comment 6 Sourceware Commits 2018-06-09 17:27:30 UTC
The gdb-8.1-branch branch has been updated by Paul Koning <pkoning@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=863d5065467b16304f6b5c80a186e3bcc68c48a6

commit 863d5065467b16304f6b5c80a186e3bcc68c48a6
Author: Paul Koning <paul_koning@dell.com>
Date:   Sat Jun 9 13:24:34 2018 -0400

    Fix build issue with Python 3.7
    
    Originally reported in
    https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails
    with Python 3.7 due to references to a Python internal function whose
    declaration changed in 3.7.
    
    gdb/ChangeLog
    2018-06-09  Paul Koning  <paul_koning@dell.com>
    
    	    PR gdb/23252
    
    	    * python/python.c (do_start_initialization):
    	    Avoid call to internal Python API.
    	    (init__gdb_module): New function.