Bug 1577396 - gdb fails to build with Python 3.7
Summary: gdb fails to build with Python 3.7
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Phil Muldoon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON37
TreeView+ depends on / blocked
 
Reported: 2018-05-11 21:48 UTC by Miro Hrončok
Modified: 2023-05-15 09:11 UTC (History)
18 users (show)

Fixed In Version: gdb-8.1.50.20180605-18.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-08 21:41:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Build log of gdb building against python 3.7 (1.16 MB, text/plain)
2018-05-11 21:48 UTC, Miro Hrončok
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Python 33470 0 None None None 2018-05-14 16:58:33 UTC

Description Miro Hrončok 2018-05-11 21:48:42 UTC
Created attachment 1435151 [details]
Build log of gdb building against python 3.7

Description of problem:
When I try to bootsrap gdb / python 3.7, it fails to build with 3.7.

Version-Release number of selected component (if applicable):
8.1-15.fc29


Steps to Reproduce:

1. Build gdb --without python
2. Build python3 3.7  https://src.fedoraproject.org/fork/churchyard/rpms/python3/tree/master37
3. Build gdb --with python

Actual results:

BUILDSTDERR: ../../gdb/python/python.c: In function 'bool do_start_initialization()':
BUILDSTDERR: ../../gdb/python/python.c:1853:45: error: too few arguments to function 'int _PyImport_FixupBuiltin(PyObject*, const char*, PyObject*)'
BUILDSTDERR:    _PyImport_FixupBuiltin (gdb_module, "_gdb");
BUILDSTDERR:                                              ^
BUILDSTDERR: In file included from /usr/include/python3.7m/Python.h:126,
BUILDSTDERR:                  from ../../gdb/python/python-internal.h:100,
BUILDSTDERR:                  from ../../gdb/python/python.c:94:
BUILDSTDERR: /usr/include/python3.7m/import.h:113:17: note: declared here
BUILDSTDERR:  PyAPI_FUNC(int) _PyImport_FixupBuiltin(
BUILDSTDERR:                  ^~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: make[2]: *** [Makefile:1621: python/python.o] Error 1
BUILDSTDERR: make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/BUILD/gdb-8.1/build-x86_64-redhat-linux-gnu/gdb'
BUILDSTDERR: make[1]: *** [Makefile:8157: all-gdb] Error 2
make[1]: Leaving directory '/builddir/build/BUILD/gdb-8.1/build-x86_64-redhat-linux-gnu'
BUILDSTDERR: make: *** [Makefile:850: all] Error 2

Expected results:

Should build.


Build log attached.

Comment 2 Phil Muldoon 2018-05-14 15:21:10 UTC
https://bugs.python.org/issue33470

Adding this as a cross reference. Hopefully we can find out what is changed, and the reasons why, and we can create a fix for upstream as well as downstream GDB.

Comment 3 Victor Stinner 2018-05-15 16:25:06 UTC
> BUILDSTDERR: ../../gdb/python/python.c:1853:45: error: too few arguments to function 'int _PyImport_FixupBuiltin(PyObject*, const char*, PyObject*)'

This is a private API, gdb should not use it. I don't know why gdb chose to call a private function.

To fix gdb, an #ifdef using PY_VERSION_HEX should be use to pass one more additional parameter to Python 3.7: "modules". This parameter can be found in interp->modules, where interp is the current interpreter. For example, use PyThreadState_Get()->interp to get the current interpreter.

Comment 4 Miro Hrončok 2018-05-28 22:24:30 UTC
Phil?

Comment 5 Phil Muldoon 2018-05-29 11:42:41 UTC
I've brought the issue up with upstream. I don't understand the purpose of the existing GDB code and so I've asked upstream for a resolution.

https://sourceware.org/ml/gdb/2018-05/msg00027.html

I'll monitor it and update this bug as the situation evolves.

Comment 6 Sergio Durigan Junior 2018-05-31 20:11:19 UTC
A patch has been posted upstream:

https://sourceware.org/ml/gdb-patches/2018-05/msg00863.html

Comment 7 Miro Hrončok 2018-06-08 10:36:43 UTC
Any news on that? 3.7.0c1 is expected in 3 days (2018-06-11, [1]). I'd like to start building stuff in a side tag soon after that.


[1] https://www.python.org/dev/peps/pep-0537/

Comment 8 Phil Muldoon 2018-06-08 14:30:58 UTC
A patch has been submitted upstream, approved by the moderators, but it is not currently (as of an hour ago) checked in. Sergio may be able to carry the patch temporarily in the GDB rpm until upstream GDB propagates out.

Comment 9 Sergio Durigan Junior 2018-06-08 15:31:52 UTC
(In reply to Miro Hrončok from comment #7)
> Any news on that? 3.7.0c1 is expected in 3 days (2018-06-11, [1]). I'd like
> to start building stuff in a side tag soon after that.
> 
> 
> [1] https://www.python.org/dev/peps/pep-0537/

I will make a release of Fedora GDB on Rawhide containing the patch later today.

Comment 10 Miro Hrončok 2018-06-08 15:39:57 UTC
Thanks.

Comment 11 Paul Koning 2018-06-08 17:49:26 UTC
This issue was tracked in https://sourceware.org/bugzilla/show_bug.cgi?id=23252

I just committed the patch and closed that gdb bug report.

Comment 12 Sergio Durigan Junior 2018-06-08 21:41:38 UTC
Fixed in gdb-8.1.50.20180605-18.fc29.

Comment 13 Miro Hrončok 2018-06-09 06:51:43 UTC
Thank you. Will retest and reopen if it doesn't work.

Comment 20 Miro Hrončok 2022-10-12 15:29:04 UTC
As this bugzilla is somewhat popular with spammers, I've checked the "(never email me about this bug)" checkbox. If anybody actually has something to say here, please open a new bugzilla instead of reopening this one.

Comment 22 laetotolive 2022-11-22 04:51:37 UTC Comment hidden (spam)

Note You need to log in before you can comment on or make changes to this bug.