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

python-config scripts contain flags to link with libpython #85

Open
rdb opened this issue Dec 20, 2016 · 3 comments
Open

python-config scripts contain flags to link with libpython #85

rdb opened this issue Dec 20, 2016 · 3 comments

Comments

@rdb
Copy link
Contributor

rdb commented Dec 20, 2016

I understand from #69 that it is recommended that extension modules be compiled with references to the CPython ABI left undefined, and that libpythonX.Y.so is therefore intentionally left omitted from the docker image.

However, the python-config scripts in the Python installations still contain -lpythonX.Y options. It would be great if this could be removed so that build scripts that use python-config to detect Python installations work correctly.

@njsmith
Copy link
Member

njsmith commented Dec 20, 2016 via email

@rdb
Copy link
Contributor Author

rdb commented Dec 20, 2016

I poked around a bit and I think fixing this would involve either shipping our own version of python-config or monkey patching the existing one.

For Python 2.6 through 3.3, this command should work:
sed -i "s/'-lpython' *+ *pyver\( *+ *sys.abiflags\)\?/''/" path/to/pythonX.Y-config

3.4 and above use a shell script instead, for which this simpler replacement should work:
sed -i 's/-lpython${VERSION}${ABIFLAGS}//' /opt/python/cp34-cp34m/bin/python3.4m-config

Does this seem like an acceptable solution or is this too hacky?

@njsmith
Copy link
Member

njsmith commented Dec 20, 2016

It's pretty hacky, but I don't see what else we can really do. IIUC it's a bug in upstream python-config (specifically, python-config and distutils should always do the same thing, and in this case it sounds like they aren't), and maybe we can fix that in future Python releases (and probably we should), but that's a slow process at best, and some of the Pythons we ship are EOL anyway.

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

No branches or pull requests

2 participants