-
Notifications
You must be signed in to change notification settings - Fork 154
Whitelisting of libraries shipped by other wheels #76
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
Comments
I would like to point out that Thus, it is not desirable to force all users of |
I am afraid that this can have unintended consequences although I cannot see any at the moment. Maybe we could have a command line argument to enable this behavior explicitly but keep it disabled by default.
That sounds safe to do as it would not impact the default behavior of |
I'm not a big fan of the use of RPATH like this, because it's fragile: virtualenvs are only one possible deployment layout for python packages. What if someone puts these two packages into different directories on PYTHONPATH? It's even possible to end up with a situation where you use the C library from one version of pyarrow together with the python code from a different version. The general solution is something like my pynativelib proposal, but that's beyond the scope of this issue... I'm just bringing this up here to say that I don't think auditwheel should add hardcoded support for this (ab)use of RPATH specifically. An explicit whilelist seems fine though. |
I don't think this is a good idea. The big idea in the My understanding is that you explicitly don't want this. You want a shared library in the Obviously there's nothing to stop anyone from retagging non- But I'm -1 on adding features to |
Exactly. It's more work to implement, but one robust way to get the behavior that you want would be to remove the ELF-level dependency on the Arrow libraries. Instead of having them loaded by the dynamic linker, you could load them yourself using |
There's a best of both worlds approach possible as well: you could keep the ELF-level dependency (so you don't need to rewrite all your code to use explicit dlopen/dladdr calls), but then before you import the extension that's linked to pyarrow, first figure out where the library is (e.g. by importing pyarrow and looking to see where the python loader found it), and then Basically the pynativelib idea is this + similar tricks for Windows and MacOS + some conventions to avoid accidental namespace collisions. |
In fact you can just use ctypes for this; see e.g. https://github.com/anntzer/mpl_cairo/blob/master/mpl_cairo/__init__.py (let me know if the example is unclear). The advantage of using ctypes is that you can write your C code as usual, without any dlopen() (which may be helpful when trying to keep things cross-platform); you just don't link the shared object when building a manylinux wheel and rely on ctypes to load the needed symbols globally before loading the extension module. |
Hi All, In light of pypi/warehouse#5420 , what is the recommend way to make a wheel that depends on shared libraries shipped by other wheels pass the audition without pulling those shared libraries in? Per suggestion by @njsmith:
if the ELF-level dependencies are kept (I assume that's the DT_NEEDED section in the header), I don't see how auditwheel will be happy without trying to pull in recursively what's in DT_NEEDED? The other suggested way, which I assume involving a dlopen(RTLD_GLOBAL), which will pollute the global symbol look up table, seems to be dangerous (also see [1]). [1] Section 1.5.4 "Lookup Scope", How To Write Shared Libraries, https://www.akkadia.org/drepper/dsohowto.pdf |
@brills Correct, right now auditwheel doesn't have any support for pynativelib-style library dependencies. This hasn't caused any problems so far because there are several pieces that need to be implemented to make those work, and no one has implemented the other pieces either. But if you want to change that, then yeah, extending auditwheel needs to be one of the steps on your to-do list. My suggestion for the auditwheel part: come up with a unique naming convention for shared libraries that are using this approach – for example, call them |
I think a command line argument to auditwheel makes more sense than a known prefix. xref #368 for adding an |
In
turbodbc
we link againstpyarrow
in such a fashion thatturbodbc
picks up the Arrow libraries via a relative RPATH in the same virtualenv. Thus we don't need to include them in themanylinux1
wheel of Turbodbc. With auditwheel's current behaviour they are sadly grafted into turbodbc's wheel. To fix this, two options come to my mind:I'm happy to implement one of these approaches but I would like to hear what the preferred one would be.
The text was updated successfully, but these errors were encountered: