Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1960117

Summary: python-pyside2 is not compatible with Python 3.10
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-pyside2Assignee: Richard Shaw <hobbes1069>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cz172638, hobbes1069, john, laurent.rineau__fedora, mhroncok, thrnciar, tuju
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-06-08 10:57:10 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    

Description Tomáš Hrnčiar 2021-05-13 05:20:38 UTC
freecad fails to build with Python 3.10.0b1.

[  2%] Building CXX object src/Base/CMakeFiles/FreeCADBase.dir/BaseClass.cpp.o
cd /builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu/src/Base && /usr/bin/g++ -DFreeCADBase_EXPORTS -DHAVE_CONFIG_H -DHAVE_SWIG=1 -DPYCXX_6_2_COMPATIBILITY -DPYCXX_PYTHON_2TO3 -DQT_CORE_LIB -DQT_NO_DEBUG -D_OCC64 -I/builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu -I/builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu/src -I/builddir/build/BUILD/FreeCAD-0.19.2/src -I/builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu/src/Base -I/builddir/build/BUILD/FreeCAD-0.19.2/src/Base -I/usr/include/python3.10 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -Wall -Wextra -Wno-write-strings -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fPIC -std=gnu++11 -MD -MT src/Base/CMakeFiles/FreeCADBase.dir/BaseClass.cpp.o -MF CMakeFiles/FreeCADBase.dir/BaseClass.cpp.o.d -o CMakeFiles/FreeCADBase.dir/BaseClass.cpp.o -c /builddir/build/BUILD/FreeCAD-0.19.2/src/Base/BaseClass.cpp
In file included from /usr/include/python3.10/unicodeobject.h:1046,
                 from /usr/include/python3.10/Python.h:87,
                 from /builddir/build/BUILD/FreeCAD-0.19.2/src/Base/PyObjectBase.h:38,
                 from /builddir/build/BUILD/FreeCAD-0.19.2/src/Base/BaseClass.cpp:32:
/usr/include/CXX/Python3/Objects.hxx: In member function 'const Py_UNICODE* Py::String::unicode_data() const':
/usr/include/python3.10/cpython/unicodeobject.h:279:26: warning: 'Py_UNICODE* PyUnicode_AsUnicode(PyObject*)' is deprecated [-Wdeprecated-declarations]
  279 |       PyUnicode_AsUnicode(_PyObject_CAST(op)))
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
  580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      |                                             ^~~~~~~~~~~~~~~~~~~

bpo-36346: Mark Py_UNICODE_COPY, Py_UNICODE_FILL, PyUnicode_WSTR_LENGTH, PyUnicode_FromUnicode, PyUnicode_AsUnicode, and PyUnicode_AsUnicodeAndSize as deprecated in C. Remove Py_UNICODE_MATCH which was deprecated and broken since Python 3.3.
https://bugs.python.org/issue36346

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

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

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 Richard Shaw 2021-05-13 11:51:30 UTC
I don't see an actual error in the above, just warnings. While not ideal FreeCAD is very large so often only real problems get worked on.

In inspecting the log file I do see:

PySide2/__init__.py: Unable to import shiboken2 from , /usr/lib64/python310.zip, /usr/lib64/python3.10, /usr/lib64/python3.10/lib-dynload, /usr/lib64/python3.10/site-packages, /usr/lib/python3.10/site-packages
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.10/site-packages/PySide2/__init__.py", line 107, in <module>
    _setupQtDirectories()
  File "/usr/lib64/python3.10/site-packages/PySide2/__init__.py", line 58, in _setupQtDirectories
    import shiboken2
  File "/usr/lib64/python3.10/site-packages/shiboken2/__init__.py", line 27, in <module>
    from .shiboken2 import *
ImportError: /lib64/libshiboken2.cpython-310-x86_64-linux-gnu.so.5.15: undefined symbol: _Py_Mangle
================================
PySide2 Python module not found.
================================

...

[ 71%] Linking CXX executable ../../bin/FreeCAD
cd /builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu/src/Main && /usr/bin/cmake -E cmake_link_script CMakeFiles/FreeCADMain.dir/link.txt --verbose=1
/usr/bin/g++ -Wall -Wextra -Wno-write-strings -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld CMakeFiles/FreeCADMain.dir/MainGui.cpp.o -o ../../bin/FreeCAD  -Wl,-rpath,/builddir/build/BUILD/FreeCAD-0.19.2/x86_64-redhat-linux-gnu/lib: ../../lib/libFreeCADGui.so ../../lib/libFreeCADApp.so ../../lib/libFreeCADBase.so /usr/lib64/libxerces-c.so /usr/lib64/libz.so /usr/lib64/libpython3.10.so -lutil -ldl /usr/lib64/libzipios.so /usr/lib64/libboost_filesystem.so /usr/lib64/libboost_program_options.so /usr/lib64/libboost_regex.so /usr/lib64/libboost_system.so -lboost_thread /usr/lib64/libboost_chrono.so /usr/lib64/libboost_date_time.so /usr/lib64/libboost_atomic.so -lpthread /usr/lib64/libQt5Xml.so.5.15.2 -lCoin /usr/lib64/libboost_serialization.so /usr/lib64/libQt5OpenGL.so.5.15.2 /usr/lib64/libQt5PrintSupport.so.5.15.2 /usr/lib64/libQt5Svg.so.5.15.2 /usr/lib64/libQt5Network.so.5.15.2 /usr/lib64/libQt5UiTools.a /usr/lib64/libQt5Widgets.so.5.15.2 /usr/lib64/libQt5Gui.so.5.15.2 /usr/lib64/libQt5Core.so.5.15.2 /usr/lib64//libQt5Widgets.so /usr/lib64//libQt5Gui.so /usr/lib64//libQt5Core.so /usr/lib64//libQt5Widgets.so /usr/lib64//libQt5Gui.so /usr/lib64//libQt5Core.so /usr/lib64/libGL.so -lpthread /usr/lib64/libspnav.so /usr/lib64/libshiboken2.cpython-310-x86_64-linux-gnu.so /usr/lib64/libpyside2.cpython-310-x86_64-linux-gnu.so 
/usr/bin/ld: /usr/lib64/libshiboken2.cpython-310-x86_64-linux-gnu.so: undefined reference to `_Py_Mangle'
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/Main/CMakeFiles/FreeCADMain.dir/build.make:135: bin/FreeCAD] Error 1

Which appears to be the reason the build fails.

Comment 2 Miro Hrončok 2021-06-04 20:15:54 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 3 Miro Hrončok 2021-06-07 23:00:15 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 4 Miro Hrončok 2021-06-08 10:57:10 UTC

*** This bug has been marked as a duplicate of bug 1902618 ***