-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Can't figure out how to build a python that uses the .SO file #65
Comments
At first, I don't recommend you to use Second, if you want to create shared library of CPython, you might need to specify Third, the binary size issue between CentOS and Debian sounds strange for me. I'd like to check the difference between them. |
@yyuu perhaps pyenv could set LD_LIBRARY_PATH from the shim when invoking a python binary compiled with '--enable-shared'? Setting LD_LIBRARY_PATH explicitly on bashrc has the problem that system applications(ubuntu apps for example) that depend on libpython will be dynamically linked to the wrong file. It would be nice to build some apps like vim or weechat against a libpython compiled with pyenv
|
Here is how we deal with it
Considering the # of webapps that need mod_wsgi, this really needs to be an option, or maybe even the default. |
The |
I found a better way to do it that doesn't depend on pyenv setting LD_LIBRARY_PATH:
This will add the the python lib directory to the rpath of the python executable. The rpath is searched before LD_LIBRARY_PATH and ld.conf.so, so there's no way pyenv's installed python will try to load the system's libpython which may be of a different version. |
I pushed 43212f6 which will set
|
Thanks, we just started messing with rpath for some of our SO's yesterday. |
We just got this working with rpath too! Thanks for being on top of this, @yyuu! |
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead.
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead. Closes #25783. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Changes: * pyenv: Reliably detect parent shell in `pyenv init` (pyenv/pyenv#93) * pyenv: Import recent changes from rbenv 0.4.0 * pyenv: Import `bats` tests from rbenv 0.4.0 * python-build: Add new CPython releases candidates; 3.4.0b2 * python-build: Add ruby-build style patching feature (pyenv/pyenv#91) * python-build: Set `RPATH` if `--enable-shared` was given (pyenv/pyenv#65, pyenv/pyenv#66, pyenv/pyenv#82) * python-build: Update default setuptools version (2.0 -> 2.1) * python-build: Update default pip version (1.4.1 -> 1.5) * python-build: Activate friendly CPython during build if the one is not activated * python-build: Fix broken install.sh * python-build: Import recent changes from ruby-build v20131225.1 * python-build: Fix build error of CPython 2.x on the platform where the `gcc` is llvm-gcc. * version-ext-compat: Removed from default plugin. Please use [pyenv-version-ext](https://github.com/yyuu/pyenv-version-ext) instead. Closes Homebrew#25783. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
For reference: when building Vim make sure to only enable either python2 or python3, otherwise Vim's dynamic loading of python will cause Vim to pick up the system's python. |
I use fish shell, what should I do ?
|
I solved it.
|
All of this is with 2.7.5
We are trying to build on Centos6, the python pyenv builds produces a libpython.a, but not a libpython.so
We have an importable module we build against python using libboostpython. These need to link against a libpython.so
We also need to run under mod_wsgi in apache, so the shims situation is problemmatic. I've set PYTHONHOME to point at the pyenv version of python, but it still goes after 2.6 modules on the main system.
Maybe I'm wrong here, but I am thinking if I could build python to use the .so library, and then link my extension against it, it would work (it does on Debian where I'm NOT using pyenv because I have 2.7 as the base python)
How do you get pyenv to build a python that is based on libpython.so instead of libpython.a?
python is 6MB on Centos, vs 2MB on Debian, I'm assuming that is because libpython.so makes up the other 4MB.
The text was updated successfully, but these errors were encountered: