Post

Replies

Boosts

Views

Activity

protocol_addMethodDescription problems
Hi, I'm wondering if anyone else has seen this (and hopefully found a workaround). I'm working on a bug in PyObjC (https://github.com/ronaldoussoren/pyobjc/issues/17) related to protocols and can reproduce this in pure (Objective-)C. PyObjC creates a protocol and populates the method descriptors using the Objective-C runtime API, e.g. objc_allocateProtocol and protocol_getMethodDescription. This appears to work unreliably when adding multiple methods using protocol_getMethodDescription when the selector name and/or type encoding argument to protocol_getMethodDescription are not static strings: When the arguments are not static strings I have trouble finding the method descriptor using protocol_getMethodDescription. The code fails intermittently when adding two methods (but still fairly often), and fails reliably for me when adding 3 methods. The PyObjC issue I mentioned earlier contains a full reproducer.
1
0
605
Feb ’23
(CPython) Warning about chained fixups when using ``-undefined dynamic_lookup``
I'm a core developer with the CPython project and I am researching a warning we're getting with recent version of the system compiler. First some background: The CPython interpreter can be extended using extension modules. Those modules are shared libraries with a known entry point based on the extension name and are loaded using dlopen(3).  Currently extension modules are not linked to libpython (or a python framework), but use -undefined dynamic_lookups to look up symbols at runtime. The major advantage for us for this is that compiled extension modules can be used with multiple different python distributions (our own installer, homebrew, anaconda, ...), which makes it possible to redistribute compiled extensions on the PyPI index. A minor advantage is that the same build procedure can be used with all types of CPython builds (statically linked, shared library, framework). A disadvantage is that some build errors are only detected at runtime (e.g. typo's in symbol names). The issue: With recent versions of Xcode (and the commmand line tools) we get link errors when linking extension modules: ld: warning: -undefined dynamic_lookup may not work with chained fixups We've been unable to come up with a good fix for this so far. What we've looked into: Use -bundle_loader .../python while linking This works for static builds, but not for shared library builds even when reexporting libpython symbols in the executable. Link extension modules to libpython using @rpath This won't work with static builds as there is no shared library to link to. Is there a way to avoid this problem without disabling chained fixups (for which there is no documented link option)? We're tracking this issue in #97524 in CPython's GitHub repository.
1
0
1.4k
Nov ’22