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):
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
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: 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: make: *** [Makefile:1621: python/python.o] Error 1
BUILDSTDERR: make: *** Waiting for unfinished jobs....
make: Leaving directory '/builddir/build/BUILD/gdb-8.1/build-x86_64-redhat-linux-gnu/gdb'
BUILDSTDERR: make: *** [Makefile:8157: all-gdb] Error 2
make: Leaving directory '/builddir/build/BUILD/gdb-8.1/build-x86_64-redhat-linux-gnu'
BUILDSTDERR: make: *** [Makefile:850: all] Error 2
Build log attached.
CC'ing Victor who was one of the reviewers.
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.
> 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.
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.
I'll monitor it and update this bug as the situation evolves.
A patch has been posted upstream:
Any news on that? 3.7.0c1 is expected in 3 days (2018-06-11, ). I'd like to start building stuff in a side tag soon after that.
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.
(In reply to Miro Hrončok from comment #7)
> Any news on that? 3.7.0c1 is expected in 3 days (2018-06-11, ). I'd like
> to start building stuff in a side tag soon after that.
>  https://www.python.org/dev/peps/pep-0537/
I will make a release of Fedora GDB on Rawhide containing the patch later today.
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.
Fixed in gdb-22.214.171.12480605-18.fc29.
Thank you. Will retest and reopen if it doesn't work.