Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1763

pyside2 v5.15.2 fails to build with python ≥ 3.10

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.15.2
    • Build System, PySide, Shiboken
    • None
    • macOS

    Description

      hello,

      first time reporting an issue here, so forgive me if i'm missing something obvious.

      a group of us (homebrew-freecad tap) are using pyside2 along with shiboken to aid in the building of FreeCAD for macos. freecad has yet to migrate to qt6 so freecad still relies on qt5 along with pyside2 v5.15.2 & shiboken to build the latest version of freecad from the git source.

      the same group of people use macos homebrew to manage and install software required to build freecad, and recently homebrew started building software that uses python 3.10

      it has been reported to the homebrew-freecad tap that pyside2 v5.15.2 will not build with python 3.10. i can confirm that pyside (v5.15.2) will not build with python 3.10

      i managed to patch shiboken2 v5.15.2 and build it with python 3.10 but my attempts to get pyside2 v5.15.2 to build with python 3.10 have failed.

      the freecad tap is using cmake to build both pyside and shiboken. and we are using CI/CD to build and distribute the packages using homebrew's bottling process.

      i came across the below issue where some other people were discussing building pyside2 with python 3.10 and mentioned a couple of issues they were running into.

      https://bugreports.qt.io/browse/PYSIDE-1436

      it seems there were some issues with pyside when the fedora/redhat distro moved from python 3.9 to python 3.10. i don't use those distros so i'm not entirely familiar with those issues.

      however is there any plan to have pyside2 v5.15.2 support python 3.10 or should we expect python 3.9 to be the last officially supported version of pyside2 v5.15.2 ?

      i'm able to build shiboken2 with python 3.10 using the provided patches,

      my minimum viable cmake configure command for shiboken2,

      export bp="/usr/local"
      
      export pthqt="$bp/Cellar/qt@5/5.15.2_1"
      export LLVM_INSTALL_DIR="$bp/opt/llvm"
      
      cmake \
      -DCMAKE_PREFIX_PATH="$pthqt" \
      -DCMAKE_INSTALL_PREFIX="/opt/beta/shiboken2-py310" \
      -L \
      ../../sources/shiboken2/
      

      after i build and install shiboken2 i attempt to configure and build pyside2 with the below cmake configuration setup,

      cmake \
      -DCMAKE_INSTALL_PREFIX=/opt/beta/pyside2-py310 \
      -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev \
      -DPYTHON_EXECUTABLE=/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/python3.10 \
      -DPYTHON_LIBRARY=/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/libpython3.10.dylib \
      -DPYTHON_INCLUDE_DIR=/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk \
      -DCMAKE_FIND_FRAMEWORK=LAST \
      -DCMAKE_PREFIX_PATH="$pthqt;" \
      ../../sources/pyside2
      

      i get below build error with the above cmake configuration for pyside2

      [ 16%] Building CXX object PySide2/QtGui/CMakeFiles/QtGui.dir/PySide2/QtGui/qabstractopenglfunctions_wrapper.cpp.o
      cd /opt/code/git/qt/pyside-git/pyside-setup/build/pyside2-py310/PySide2/QtGui && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DPYSIDE_QML_SUPPORT=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQtGui_EXPORTS -I/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2/QtGui/QtGui -I/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2/QtGui -I/opt/code/git/qt/pyside-git/pyside-setup/build/pyside2-py310/PySide2/QtGui -I/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2 -I/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/libpyside -I/opt/code/git/qt/pyside-git/pyside-setup/build/pyside2-py310/PySide2/QtCore/PySide2/QtCore -iframework /usr/local/Cellar/qt@5/5.15.2_1/lib -isystem /usr/local/Cellar/qt@5/5.15.2_1/lib/QtCore.framework/Headers -isystem /usr/local/Cellar/qt@5/5.15.2_1/./mkspecs/macx-clang -isystem /usr/local/Cellar/qt@5/5.15.2_1/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -isystem /opt/beta/shiboken2-py310/include/shiboken2 -isystem /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Wall -fvisibility=hidden -Wno-strict-aliasing -O2 -g -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC -fPIC -fPIC -std=gnu++11 -MD -MT PySide2/QtGui/CMakeFiles/QtGui.dir/PySide2/QtGui/qabstractopenglfunctions_wrapper.cpp.o -MF CMakeFiles/QtGui.dir/PySide2/QtGui/qabstractopenglfunctions_wrapper.cpp.o.d -o CMakeFiles/QtGui.dir/PySide2/QtGui/qabstractopenglfunctions_wrapper.cpp.o -c /opt/code/git/qt/pyside-git/pyside-setup/build/pyside2-py310/PySide2/QtGui/PySide2/QtGui/qabstractopenglfunctions_wrapper.cpp
      /opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py:199: RuntimeWarning: pyside_type_init:
      
      UNRECOGNIZED: 'zero(Any)'
       OFFENDING LINE: 'PySide2.QtCore.QSettings.value(self,arg__1:QString,defaultValue:QVariant=0,type:PyObject=0)->PyObject'
      
      warnings.warn("""pyside_type_init:
      Traceback (most recent call last):
       File "/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 326, in <module>
       generate_all_pyi(outpath, options=options)
       File "/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 305, in generate_all_pyi
       generate_pyi(import_name, outpath, options)
       File "/opt/code/git/qt/pyside-git/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 241, in generate_pyi
       HintingEnumerator(fmt).module(import_name)
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/lib/enum_sig.py", line 95, in module
       ret.update(self.klass(class_name, klass))
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/lib/enum_sig.py", line 129, in klass
       signature = getattr(thing, "__signature__", None)
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 97, in pyside_type_init
       return parser.pyside_type_init(type_key, sig_strings)
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 447, in pyside_type_init
       props = calculate_props(line)
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 344, in calculate_props
       annotations["return"] = (_resolve_type(returntype, line, 0, handle_retvar)
       File "/opt/beta/shiboken2-py310/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 280, in _resolve_type
       return eval(result, namespace)
       File "<string>", line 1, in <module>
       File "/usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py", line 1186, in __getitem__
       return self.__getitem_inner__(params)
       File "/usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py", line 311, in inner
       return func(*args, **kwds)
       File "/usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py", line 1192, in __getitem_inner__
       result = _type_check(result, msg)
       File "/usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py", line 171, in _type_check
       raise TypeError(f"Plain \{arg} is not valid as type argument")
      TypeError: Plain typing.Optional is not valid as type argument
      make[2]: *** [PySide2/QtCore/CMakeFiles/QtCore_pyi] Error 1
      make[1]: *** [PySide2/QtCore/CMakeFiles/QtCore_pyi.dir/all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      

      please let me know if failed to provide some information for this build error.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              ipatch chris jones
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes