Flatpak Pyside2 build error

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Flatpak Pyside2 build error

Post by mdhill »

I borrowed Peter Eszlari's Flatpak manifest and modified it for FreeCAD master, and Python 3. It builds with Pyside2 5.12, but I get a problem that looks like this:

https://tracker.freecadweb.org/view.php?id=4195

Shiboken 5.14 apparently fixes this.

The Pyside2 manifest entry looks like this (I've changed the source archive to 5.14):

Code: Select all

  - name: pyside2
    buildsystem: simple
    build-commands:
      - mkdir -p /app/qt5include && cp -R /usr/include/Qt* /app/qt5include # https://bugreports.qt.io/browse/PYSIDE-787
      - cd sources/shiboken2 && mkdir _build && cd _build &&
        cmake -GNinja
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
        -DCMAKE_INSTALL_PREFIX=/app
        -DUSE_PYTHON_VERSION=3
        -DBUILD_TESTS=OFF .. &&
        ninja install
      - cd sources/pyside2 && mkdir _build && cd _build &&
        cmake -GNinja
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
        -DCMAKE_INSTALL_PREFIX=/app
        -DUSE_PYTHON_VERSION=3
        -DBUILD_TESTS=OFF .. &&
        ninja install
      - cd sources/pyside2-tools && mkdir _build && cd _build &&
        cmake -GNinja
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
        -DCMAKE_INSTALL_PREFIX=/app
        -DBUILD_TESTS=OFF .. &&
        ninja install
    cleanup:
      - /qt5include
      - /bin
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.14.1-src/pyside-setup-opensource-src-5.14.1.tar.xz
        sha256: 41ce931695567639c92acb68a9d66ed5609f067011af9a94b53fc0d697ad1d1c
      - type: shell
        commands:
          - sed -i 's|\(--include-paths=\)|\1/app/qt5include:|' sources/pyside2/cmake/Macros/PySideModules.cmake
Shiboken builds and installs, but the Pyside2 configuration fails like this:

Code: Select all

Running: cd sources/pyside2 && mkdir _build && cd _build && cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/app -DUSE_PYTHON_VERSION=3 -DBUILD_TESTS=OFF .. && ninja install
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:47 (message):
  Could not identify PySide2 version.  Error:


-- Configuring incomplete, errors occurred!
See also "/run/build/pyside2/sources/pyside2/_build/CMakeFiles/CMakeOutput.log".
Error: module pyside2: Child process exited with code 1
Can I specify the version somehow?
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Re: Flatpak Pyside2 build error

Post by mdhill »

One thought was the latest Pyside2 (5.14.1) doesn't match the version number of the Platform/SDK (5.14), so I switched to this:

pyside-setup-opensource-src-5.14.0.tar.xz

...but the same error results.
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Re: Flatpak Pyside2 build error

Post by mdhill »

I tried this again with Qt/KDE runtime 5.12 and Pyside2 5.12.1. It now fails with this during the FreeCAD build:

https://bugreports.qt.io/browse/QTBUG-81715

Before trying to patch it, I tried Pyside2 5.12.1 with runtime 5.14. Everything builds, and FreeCAD runs with some non-fatal errors I'll look into, but not the Shiboken Add-on Manager crash.
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Re: Flatpak Pyside2 build error

Post by mdhill »

sources/pyside2/CMakeLists.txt was half the size for 5.14.1 as it was for 5.12.1. I patched in the missing lines and changed this line to 5.14:

Code: Select all

find_package(Qt5 5.12 REQUIRED COMPONENTS Core)
allowing the build to complete. I switched the source to git, and found the same issue with each branch after 5.12.1.

Dr Cristián Maureira-Fredes on the Pyside mailing list suggested that what was missing from CMakeLists.txt was "pieces of cmake code that were transformed into macros and placed under the cmake helpers we provide. I'm afraid your building process was not using them, since you stated that adding the missing line was useful to finish the build."

I'm wondering if hobbes1069, PrzemoF, or eszlari have seen this configuration issue with earlier versions.
mdhill
Posts: 85
Joined: Mon Apr 24, 2017 7:37 pm

Re: Flatpak Pyside2 build error

Post by mdhill »

Peter Eszlari has done the hard work, updating the stable version to Pyside2 5.14.2:

https://github.com/flathub/org.freecadweb.FreeCAD

He reduced Shiboken and Pyside back down to this, with some messing around at the end with uic and rcc:

Code: Select all

- name: pyside2
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    cleanup:
      - /bin
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.14.2-src/pyside-setup-opensource-src-5.14.2.tar.xz
        sha256: 7c7af33792de57255dbdc165c808e1f03a2520295c5922d9897aca8ad1be92b3
      - type: shell
        commands:
          - mkdir -p /app/include/qt5tmp && cp -R /usr/include/Qt* /app/include/qt5tmp
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt5tmp:|' sources/pyside2/cmake/Macros/PySideModules.cmake
FreeCAD git master builds with the same manifest if you change the commit: line to branch: master.
Post Reply