Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pybind __eq__ methods #578

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

boxanm
Copy link
Collaborator

@boxanm boxanm commented Jul 2, 2024

Description

Summary:

Fixed an unknown symbol error when importing libpointmatcher's Python bindings on arm64-based MacOS.
Also, fixed failing tests on new boost version.

Changes and type of changes (quick overview):

  • When importing pypointmatcher in Python on arm64-based MacOS, I was getting this error:
"ImportError: dlopen(/Volumes/CaseSensitive/libpointmatcher/python/pypointmatcher/pypointmatcher_native.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '__ZNK14PointMatcherIOIfE10PLYElementeqERKS1_'"

Demangling the symbol error, it complains about this function:

bool PointMatcherIO<float>::PLYElement::operator==(const PointMatcherIO<float>::PLYElement&) const
  • Following this discussion, I replaced the direct definitions of the __eq__ method with pybind11::self == pybind11::self and pybind11::self != pybind11::self and overwriting the C++ operator== and operator!= with friend functions.
  • I think that the issue did not occur on Ubuntu distros due to different build tools, but I'm not certain. In any case, it solves the problem on MacOS.

Checklist:

Code related

  • I have made corresponding changes to the documentation
    (i.e.: function, class, script header, README.md)
  • I have commented hard-to-understand code
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
    (Check contributing_instructions.md for local testing procedure using libpointmatcher-build-system)

PR creation related

  • My pull request base ref branch is set to the develop branch
    (the build-system won't be triggered otherwise)
  • My pull request branch is up-to-date with the develop branch
    (the build-system will reject it otherwise)

PR description related

  • I have included a quick summary of the changes
  • I have indicated the related issue's id with # <issue-id> if changes are of type fix
  • I have included a high-level list of changes and their corresponding types
    (See commit_msg_reference.md for details)

Copy link

sonarcloud bot commented Jul 2, 2024

@boxanm boxanm marked this pull request as draft July 12, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants