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

[FR] Compile Shared Library #4435

Open
1 task done
gentlegiantJGC opened this issue Jun 25, 2024 · 1 comment
Open
1 task done

[FR] Compile Shared Library #4435

gentlegiantJGC opened this issue Jun 25, 2024 · 1 comment
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.

Comments

@gentlegiantJGC
Copy link
Contributor

gentlegiantJGC commented Jun 25, 2024

What's the problem this feature will solve?

As discussed in #2806 and in this stack overflow post there is demand for compiling dynamic libraries as part of the setuptools build process and then linking against them in python extensions or using them with ctypes or other tools.

I believe currently people either pre-compile the shared library before or have a hacky extension to setuptools.

Describe the solution you'd like

I would like to propose that setuptools adds native support for compiling shared libraries as part of the build process.

I don't know exactly how this would be implemented but my though process was that another command would be added eg build_shared_clib to complement the existing build_clib and another argument would be added to setup() eg shared_libraries to compliment libraries

Alternative Solutions

Compile the shared library separately.
Manual plugin like in the stack overflow post.
https://github.com/mdavidsaver/setuptools_dso

Additional context

I would be interested in helping getting such a feature implemented.
Is this something that setuptools would be interested in merging?

Code of Conduct

  • I agree to follow the PSF Code of Conduct
@gentlegiantJGC gentlegiantJGC added enhancement Needs Triage Issues that need to be evaluated for severity and status. labels Jun 25, 2024
@gentlegiantJGC
Copy link
Contributor Author

gentlegiantJGC commented Jun 26, 2024

Reading around some more, there seem to be issues with import paths.
Python extension modules will look for shared libraries next to them and in some other locations as discussed here
That would raise some issues if the dependent python extensions were not all next to the shared library.
dll directories can be manually extended but I assume setuptools wouldn't want to do that.

I also have the use case where I have one python package that depends on the C API of another package which I was planning on exposing through a shared library. This has the import path issue and also on Windows has the issue that the import library (.lib) is needed to compile against the shared library. To support that the lib file would need to be distributed with the package. If this was supported it would need to be an optional feature.

Extra reading:
https://discuss.python.org/t/installation-of-shared-objects-into-separate-folder/8489
https://discuss.python.org/t/wheel-depending-on-shared-library-from-another-wheel/26456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant