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

Install 32bit python on 64bit system #66

Closed
s1341 opened this issue Oct 16, 2013 · 12 comments
Closed

Install 32bit python on 64bit system #66

s1341 opened this issue Oct 16, 2013 · 12 comments

Comments

@s1341
Copy link
Contributor

s1341 commented Oct 16, 2013

Some applications require a 32bit python. These apps link (dynamically) against the libpythonXX.so.

I'm working on adding support for installing a 32bit python using pyenv install and will submit a pull request if necessary when I'm done.

Is this something others are interested in?

@yyuu
Copy link
Contributor

yyuu commented Oct 16, 2013

I have never ran into similar problems. Though, the patches are welcome 👍

@s1341
Copy link
Contributor Author

s1341 commented Nov 3, 2013

Hi,

So I've played with it a bit and I have found the following to work:

This works, but requires LD_LIBRARY_PATH to be set at run time:

CONFIGURE_OPTS="LDFLAGS=-m32 CFLAGS=-m32 --enable-shared" LD_LIBRARY_PATH=`pwd`/versions/2.7.4/lib:$LD_LIBRARY_PATH pyenv install 2.7.4 -vfk

This is better. It doesn't require LD_LIBRARY_PATH at all. There is, however, an issue with bash quoting or whatever which causes this to fail on stock pyenv. Echoing the command at line 541 in pyenv-build to a file and then executing that file solves this issue.

PYTHON_CONFIGURE_OPTS='LDFLAGS="-m32 -Wl,-rpath=/root/pyenv-tests/pyenv/versions/2.7.3_32bit/lib" CFLAGS=-m32 --enable-shared' VERSION_NAME=2.7.3_32bit pyenv install 2.7.3 -vfk

The following seems to work on OSX, somehow without any DYLIB paths or PYTHONHOME: Note that you need to brew install zlib, readline and sqlite with --universal, and the same bash quoting issue needs to be worked around here too.

PYTHON_CONFIGURE_OPTS='LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/sqlite/lib -m32" CFLAGS="-m32 -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/sqlite/include" --enable-shared' VERSION_NAME=2.7.3_32bit pyenv install 2.7.3 -vfk

It's probably worth determining how to add rpaths here too.

All in all, changes to stock pyenv:

  • comment out the unset of VERSION_NAME in order to be able to give 'aliased' names for e.g. 2.7.3-32bit. Perhaps it would be useful to add an --as argument to pyenv install.
  • work around the bash quoting issue in order to be able to specify LDFLAGS containing spaces. I would be very grateful for assistance in resolving this issue properly. I couldn't figure out how to quote the LDFLAGS correctly so that it would be passed sanely to configure.

How would it be best to integrate this into pyenv? Custom definitions? A patch to add -32 (like --debug)? Is anyone else even interested in this?

@jstarsky
Copy link

jstarsky commented Dec 5, 2013

I am sorry i am new with pyenv. what i need to do for have python 2.6.9 in 32bit and also install python 3.3.0 32bits and 64 bits. i cant do it. thanks

@s1341
Copy link
Contributor Author

s1341 commented Dec 5, 2013

I have not yet completed implementing this. Waiting for some feedback from @yyuu.

What os are you running?

On Dec 5, 2013, at 19:29, Starsky Lara notifications@github.com wrote:

I am sorry i am new with pyenv. what i need to do for have python 2.6.9 in 32bit and also install python 3.3.0 32bits and 64 bits. i cant do it. thanks


Reply to this email directly or view it on GitHub.

@jstarsky
Copy link

jstarsky commented Dec 5, 2013

i am running osx maverick

@jstarsky
Copy link

jstarsky commented Dec 5, 2013

or at less do you known how to install python 2.6.9 with pyenv but 32 bits

@yyuu
Copy link
Contributor

yyuu commented Dec 6, 2013

@s1341 Sorry to be late. I don't like to have definitions per target architectures. I think that doing like pyenv install --debug is fair.

I created my workaround to build 32bit binary as 387d69a (on the branch named 32), please try it later.

@s1341
Copy link
Contributor Author

s1341 commented Dec 8, 2013

@yyuu I looked at your branch. I think we need to add the rpath stuff and enable shared for this to really work properly. In most of the cases I've encountered, the reason for having a 32bit python in the first place is because some 32bit application wants to link against it.

@yyuu
Copy link
Contributor

yyuu commented Dec 20, 2013

I pushed 43212f6 which will set rpath if --enable-shared was given in PYTHON_CONFIGURE_OPTS. With this fix, following one liner will build 32bit Python with shared library.

% env PYTHON_CONFIGURE_OPTS="--enable-shared" CFLAGS="-m32" LDFLAGS="-m32" pyenv install 2.7.6

yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 10, 2014
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.
yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 10, 2014
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.
yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 10, 2014
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.
yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 10, 2014
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.
yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 23, 2014
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.
yyuu pushed a commit to yyuu/homebrew that referenced this issue Jan 23, 2014
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.
MikeMcQuaid pushed a commit to Homebrew/legacy-homebrew that referenced this issue Jan 24, 2014
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>
@yyuu
Copy link
Contributor

yyuu commented Feb 7, 2014

I don't like to add special feature for building 32bit binaries. Please use CFLAGS and LDFLAGS to specify compiler/linker flags.

@yyuu yyuu closed this as completed Feb 7, 2014
ehershey pushed a commit to ehershey/homebrew that referenced this issue Apr 4, 2014
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>
@disconnect3d
Copy link

disconnect3d commented Apr 23, 2017

I know that this is old and closed but 👍 for 32 bit targets. Any possibility to rethink adding this into Pyenv?

Shouldn't pyenv be an ultimate and easy installer for any Python version?

Or at least please state in the README how one can use CFLAGS/LDFLAGS to install 32bit Python
(so ppl won't have to search for this issue in the future ^^).

@ghost
Copy link

ghost commented Sep 23, 2017

The posted solution on this issue did not work for me:

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Honestly the approach that this project has taken of shying away with dealing with these problems has simply pushed the problems downstream. And pyenv is in fact the only way on installing Python onto CI containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants