Unable to install 32-bit Python with pyenv, despite appropriate flags set
Asked Answered
L

0

0

I'm looking to install the 2.6.6 Python as 32-bit with pyenv on OS X, but get:

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

Despite having consulted Common Build Problems, and applying the flags suggested there, as well as installing Xcode developer tools, the problem persists. Here is the full command:

CFLAGS="-I$(xcrun --show-sdk-path)/usr/include -arch i386 -I$(brew --prefix openssl)/include" LDFLAGS="-arch i386 -L$(brew --prefix openssl)/lib" CONFIGURE_OPTS="--with-arch=i386" pyenv install 2.6.6

... but this builds the 64-bit build, which is not what I need.

Oddly, the build works when just the following is tried:

CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 2.6.6

What are we missing? Does the following from the log imply that I need an openssl which was built for i386 / 32-bit?

ld: warning: ignoring file /usr/local/opt/openssl/lib/libcrypto.dylib, file   
was built for x86_64 which is not the architecture being linked (i386):   
/usr/local/opt/openssl/lib/libcrypto.dylibld: warning: 
ignoring file /usr/local/opt/openssl/lib/libssl.dylib, file was built for 
x86_64 which is not the architecture being linked (i386): 
/usr/local/opt/openssl/lib/libssl.dylib
Ludly answered 16/1, 2016 at 21:48 Comment(8)
The error message says exactly that. Why do you want the 32-bit version of Python?Pastern
Long story that is not pertinent, but if you must know, it's to allow for a very old wxPython that only works on 32-bit.Ludly
Try building the 32-bit version using these instructions: foodpicky.com/?p=99. The key appears to be using darwin-i386-cc when building.Pastern
OK. Would this achieve the same as what is suggested here: https://mcmap.net/q/833104/-how-do-i-build-openssl-as-32-bit-i386-on-mac-os-x ? And then, whatever method I use, how do I make sure that the pyenv build process uses the newly-built 32-bit install, rather than my brew install, which it seems to be currently doing?Ludly
Once you finish building, you will have a python binary somewhere in your build directory. You just need to point pyenv to that. And yes, those instructions look good.Pastern
So I built using Ned Deily's approach, resulting in in /tmp/openssl-1.0.0a. I then surmised that if I created the following symlink: sudo ln -s /tmp/openssl-1.0.0a /usr/local/opt/openssl then the build would pick up this 32-bit openssl, but it continues to warn about: warning: ignoring file /usr/local/opt/openssl/lib/libcrypto.dylib so I guess something is amiss.Ludly
Replace -L$(brew --prefix openssl)/lib" with -L/tmp/openssl-1.0.0a/lib" Make sure that path exists first (lib may be in a deeper subdir).Pastern
Do it for -I$(brew --prefix openssl)/include as well.Pastern

© 2022 - 2024 — McMap. All rights reserved.