SIP real library wrapping

ZephOne zephone at protonmail.com
Wed Jan 13 14:31:24 GMT 2021


Hello,

migrating from SIP v4 build system to SIP v5 build system I'm trying to build wheel for a simple PyQt extension written in C++, a custom event filters.

The pyproject.toml is like this :

[build-system]
requires = ["sip >=5, <7", "PyQt-builder", "PyQt5"]
buid-backend = "sipbuild.api"

[tool.sip.metadata]
name = "customeventfilters"
version = "0.7.0"
description = "Custom PyQt5 event filters"
author = "ZephOne"
author-email = "zephone at protonmail.com"
license='BSD'
requires-dist = "PyQt5"

[tool.sip.project]
sdist-excludes = [
  ".git/*",
  ".git/*/*",
  ".git/*/*/*",
  ".git/*/*/*/*",
  ".git/*/*/*/*/*",
  ".git/*/*/*/*/*/*",
  ".git/*/*/*/*/*/*/*"
]


And the project.py which is used only to specify the location of the C++ library is like this:

"""The build configuration file for CustomEventFilters, used by sip."""

import os

from pyqtbuild import PyQtBindings, PyQtProject
from sipbuild import Option

class CustomEventFilters(PyQtProject):
    """The Project class."""

    def __init__(self):
        """ Initialise the project. """

        super().__init__()

        self.bindings_factories = [MyEventFilters]

class MyEventFilters(PyQtBindings):
    """ My event filters bindings. """

    def __init__(self, project):
        """ Initialise the bindings. """

        super().__init__(
            project,
            "MyEventFilters",
            sip_file='myeventfilters.sip'
        )

    def apply_user_defaults(self, tool):
        """ Set default values for user options that haven't been set yet. """

        if self.myeventfilters_include_dir is not None:
            self.include_dirs.append(
                os.path.abspath(
                    self.myeventfilters_include_dir
                )
            )

        if self.myeventfilters_library_dir is not None:
            self.include_dirs.append(
                os.path.abspath(
                    self.myeventfilters_library_dir
                )
            )

        super().apply_user_defaults(tool)

    def get_options(self):
        """ Return the list of configurable options. """

        options = super().get_options()

        options.append(
            Option(
                "myeventfilters_include_dir",
                help="the my event filters include file directory is in DIR",
                metavar="DIR"
            )
        )

        options.append(
            Option(
                "myeventfilters_library_dir",
                help="the my event filters library is in DIR",
                metavar="DIR"
            )
        )

        return options

I think there's no problem with the C++ library (I had no problem SIP4).

With these two files I have no problem building the the wheel, using sip-wheel.
But when I try to import it in a python console I've got this error:

ImportError: /venvdir/customeventfilters/lib/python3.9/site-packages/customeventfilters.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZTI18GenericEventFilter

GenericEventFilter is a class defined in the C++ library.

Did I miss something binding the C++ extension ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210113/feae9000/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: publickey - zephone at protonmail.com - 0x755CCE18.asc
Type: application/pgp-keys
Size: 670 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210113/feae9000/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210113/feae9000/attachment.sig>


More information about the PyQt mailing list