Skip to content Skip to sidebar Skip to footer

Pyqt Static Build Fails At Make

I have commercial licenses for Qt and PyQt, and am attempting to build static versions of all required software for generating a standalone, executable program that I'm currently w

Solution 1:

I'll go ahead and share my workaround, in case someone else encounters this issue.

Currently, the build-sysroot.py script uses pyqtdeploycli to generate a configuration file for building PyQt, which includes Qt modules that cannot be statically built, such as QtWebEngine. At any rate, I ended up making a configuration file for PyQt5, and placing it into the top g-zipped folder for the PyQt5 source:

/home/(user)/(path-to)/sysroot-linux/src/PyQt5_commercial-5.8.2.tar.gz/PyQt5_commercial-5.8.2/pyqt5-linux-64.cfg

PyQt5 configuration file (pyqt5-linux-64.cfg):

# The configuration for building PyQt5 for Linux.# The target Python installation.py_platform = linux
py_inc_dir = %(sysroot)/include/python%(py_major).%(py_minor)
py_pylib_dir = %(sysroot)/lib
py_pylib_lib = python%(py_major).%(py_minor)m

# The target PyQt installation.pyqt_module_dir = %(sysroot)/lib/python%(py_major).%(py_minor)/site-packages
pyqt_sip_dir = %(sysroot)/share/sip/PyQt5

# Qt configuration common to all versions.qt_shared = False[Qt 5.6]pyqt_modules = QtCore QtGui QtWidgets

[Qt 5.5]pyqt_modules = QtCore QtGui QtWidgets

[Qt 5.4]pyqt_modules = QtCore QtGui QtWidgets

[Qt 5.3]pyqt_modules = QtCore QtGui QtWidgets

[Qt 5.2]pyqt_modules = QtCore QtGui QtWidgets

I then modified the build-sysroot.py build_pyqt5 function to no longer evoke pyqtdeploycli, and instead just use the manually-created configuration file, as follows:

defbuild_pyqt5(host, target, optional, debug):
    """ Build a target static PyQt5. """

    source = host.sysroot.find_source('PyQt5_*', optional=optional)
    if source isNone:
        return

    host.sysroot.unpack_source(source)

    license_path = os.path.join(host.sysroot.src_dir, 'pyqt-commercial.sip')
    if os.path.isfile(license_path):
        shutil.copy(license_path, 'sip')

    configuration = 'pyqt5-' + target.name + '.cfg'# Disable the call to pyqtdeploycli here# host.run(host.pyqtdeploycli, '--package', 'pyqt5', '--output',#         configuration, '--target', target.name, 'configure')

    args = [host.interpreter, 'configure.py', '--static', '--qmake',
        host.qmake, '--sysroot', str(host.sysroot), '--no-tools',
        '--no-qsci-api', '--no-designer-plugin', '--no-python-dbus',
        '--no-qml-plugin', '--no-stubs', '--configuration', configuration,
        '--sip', host.sip, '--confirm-license', '-c', '-j2']

    if debug:
        args.append('--debug')

    host.run(*args)

    host.run(host.make)
    host.run(host.make, 'install')

I have only gotten this to work for QtCore, QtGui, and QtWidgets, but others may be possible.

Post a Comment for "Pyqt Static Build Fails At Make"