[PyQt] Running pyqt-bundle on Qt source build
Phil Thompson
phil at riverbankcomputing.com
Fri Apr 17 12:39:21 BST 2020
On 17/04/2020 10:24, Florian Bruhin wrote:
> Hi,
>
> I'm trying to run pyqt-bundle on a Qt developer build built from source
> (i.e. ./configure -developer-build ...).
>
> Such a build doesn't have an install dir, but the qtbase/ repository
> folder has
> a lib/ subdirectory with all the .so files in it (even from other
> modules like
> QtWebEngine).
>
> tl;dr: It worked, but I had to patch pyqt-bundle a bit.
>
> When initially running pyqt-bundle, it fails to find libicu:
>
> PyQt5/pylupdate.abi3.so: RPATH=$ORIGIN/Qt/lib
> PyQt5/pylupdate.abi3.so: new RPATH: $ORIGIN/Qt/lib
> PyQt5/pyrcc.abi3.so: RPATH=$ORIGIN/Qt/lib
> PyQt5/pyrcc.abi3.so: new RPATH: $ORIGIN/Qt/lib
> PyQt5/QtBluetooth.abi3.so: RPATH=$ORIGIN/Qt/lib
> PyQt5/QtBluetooth.abi3.so: new RPATH: $ORIGIN/Qt/lib
> PyQt5/QtCore.abi3.so: RPATH=$ORIGIN/Qt/lib
> PyQt5/QtCore.abi3.so: new RPATH: $ORIGIN/Qt/lib
> pyqt-bundle: An internal error occurred...
> Traceback (most recent call last):
> File ".../bin/pyqt-bundle", line 8, in <module>
> sys.exit(main())
> File ".../lib/python3.8/site-packages/pyqtbuild/bundle/main.py",
> line 77, in main
> handle_exception(e)
> File ".../lib/python3.8/site-packages/sipbuild/exceptions.py",
> line 81, in handle_exception
> raise e
> File ".../lib/python3.8/site-packages/pyqtbuild/bundle/main.py",
> line 72, in main
> bundle(wheel_path=args.wheels[0], qt_dir=args.qt_dir,
> File
> ".../lib/python3.8/site-packages/pyqtbuild/bundle/bundle.py", line
> 117, in bundle
> package.bundle_qt(target_qt_dir, qt_dir, arch)
> File
> ".../lib/python3.8/site-packages/pyqtbuild/bundle/abstract_package.py",
> line 105, in bundle_qt
> md.bundle(name, target_qt_dir, qt_dir,
> File
> ".../lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 94, in bundle
> self._bundle_library(lib, target_qt_dir, qt_dir, arch)
> File
> ".../lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 209, in _bundle_library
> cls._bundle_file(name,
> File
> ".../lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 201, in _bundle_file
> shutil.copy2(src, dst)
> File "/usr/lib/python3.8/shutil.py", line 432, in copy2
> copyfile(src, dst, follow_symlinks=follow_symlinks)
> File "/usr/lib/python3.8/shutil.py", line 261, in copyfile
> with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
> FileNotFoundError: [Errno 2] No such file or directory:
> '/home/florian/code/qt/5.15/qtbase/lib/libicui18n.so.56'
>
> Additionally, even though that Qt was built against libicu 65,
> pyqt-bundle
> seems to hardcode version 56. So I patched bundle/packages/pyqt5.py to
> use
> version 65 and symlinked the library to my system-wide one:
>
> $ ln -s /usr/lib/libicui18n.so.65 /usr/lib/libicuuc.so.65
> /usr/lib/libicudata.so.65 \
> ~/code/qt/5.15/qtbase/lib/
Changing '56' to '*' in qt_metadata.py will probably work.
> Then libQt5Designer.so.5 was missing, fixed with --exclude QtDesigner.
> Next:
>
> [...]
> PyQt5/QtGui.abi3.so: RPATH=$ORIGIN/Qt/lib
> PyQt5/QtGui.abi3.so: new RPATH: $ORIGIN/Qt/lib
> pyqt-bundle: 'libQt5WaylandClient.so.5' is missing from the Qt
> installation
>
> Again I had to patch pyqt5.py to remove the dependency of QtGui on
> Qt5WaylandClient.
>
> Then I had some other issues fixed with --exclude arguments - I ended
> up with:
>
> --exclude QtDesigner --exclude QtHelp --exclude QtLocation
> --exclude QtMultimedia --exclude QtMultimediaWidgets
> --exclude QtNetworkAuth --exclude QtPositioning --exclude QtQuick
> --exclude QtRemoteObjects --exclude QtSensors --exclude
> QtSerialPort
> --exclude QtSvg --exclude QtWebSockets --exclude QtX11Extras
> --exclude QtXmlPatterns
>
> After all that, I got a wheel! Unfortunately it doesn't work:
>
> ImportError: .../site-packages/PyQt5/QtCore.abi3.so:
> undefined symbol: _ZN18QMetaObjectBuilderD1Ev, version
> Qt_5_PRIVATE_API
If Qt_5_PRIVATE_API is new in Qt v5.15 then it may be PyQt's "fault".
> (that is QMetaObjectBuilder::~QMetaObjectBuilder() demangled). No idea
> at this
> point why that wouldn't work, but that's probably not PyQt's fault.
>
> Ideally, I'd be able to do this without having to patch pyqt-bundle :)
> Thus, I'd like to request options for:
>
> - Telling pyqt-bundle where to find libicu libraries, and what version
> to use
> (or perhaps it could find out itself somehow?).
> - Telling it to assume QtGui is built without wayland support.
>
> However, if the answer is "source builds aren't supported", I'm fine
> with that
> as well. After building Qt for a couple of hours, building PyQt isn't a
> big
> deal.
Well, source builds aren't supported - they would never get tested.
Would adding an option to treat missing things as a warning rather than
an error be a more general solution?
Phil
More information about the PyQt
mailing list