Bug 1912903

Summary: boost fails to build with Python 3.10: error: '_Py_fopen' was not declared in this scope; did you mean '_Py_wfopen'?
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: boostAssignee: Jonathan Wakely <jwakely>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: dakingun, denis.arnaud_fedora, jwakely, mhroncok, thrnciar, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-08 16:11:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1890881, 1912917    

Description Tomáš Hrnčiar 2021-01-05 14:58:47 UTC
boost fails to build with Python 3.10.0a4.

libs/python/src/exec.cpp:109:14: error: '_Py_fopen' was not declared in this scope; did you mean '_Py_wfopen'?
  109 |   FILE *fs = _Py_fopen(f, "r");
      |              ^~~~~~~~~
      |              _Py_wfopen

bpo-32381: Remove the private _Py_fopen() function which is no longer needed. Use _Py_wfopen() or _Py_fopen_obj() instead.

https://docs.python.org/3.10/whatsnew/changelog.html#c-api

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01859489-boost/

For all our attempts to build boost with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/boost/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Kevin Kofler 2021-01-05 16:25:04 UTC
*** Bug 1912917 has been marked as a duplicate of this bug. ***

Comment 2 Victor Stinner 2021-01-06 08:40:42 UTC
Third party projects should not rely on the private C API: functions starting with "_Py". Boost can use fopen() instead.

If Boost needs a C API for https://www.python.org/dev/peps/pep-0446/ it should be requested and it would be a new Python feature.

For curious people, see https://bugs.python.org/issue32381 for the rationale of _Py_fopen() removal. In short, using bytes strings for filenames is causing encoding issues. Python now uses wide character strings instead internally: _Py_wfopen().

Comment 3 Victor Stinner 2021-01-06 09:12:39 UTC
I proposed https://github.com/boostorg/python/pull/344 to fix boost-python.

Comment 6 Victor Stinner 2021-02-09 15:27:12 UTC
Oh, it's good to see it fixed ;-)