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 builds without readline or openssl support #5

Closed
yaychris opened this issue Aug 23, 2016 · 4 comments
Closed

Python builds without readline or openssl support #5

yaychris opened this issue Aug 23, 2016 · 4 comments

Comments

@yaychris
Copy link

Problem

When installing python 2.7.9, readline and openssl modules are not built and installed.

Steps to reproduce

  1. Install python:
asdf install 2.7.9`
  1. Use python:
asdf local python 2.7.9
  1. Launch interactive python and attempt to import the modules:
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named readline

>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Chris/.asdf/installs/python/2.7.9/lib/python2.7/ssl.py", line 97, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl

You can also use the arrow keys and typical ctrl-* navigation commands and see the escape sequences being output.

Possible solution

Reviewing the build output, it looks the install script is setting openssl and readline options that aren't valid for python:

configure: WARNING: unrecognized options: --with-openssl-dir, --with-readline-dir, --disable-install-doc

I checked homebrew's python formula, and they are patching setup.py's readline and openssl configurations with paths to homebrew's versions.

It seems like this is the strategy required to fix this problem. Unfortunately, my bash skills aren't sharp enough to make the change myself and PR.

@yaychris
Copy link
Author

Turns out, setting the include and lib paths directly via environment variables fixes the issue:

echo "Building with options: $configure_options"

local readline_path=$(homebrew_package_path readline)
export CPPFLAGS="-I$readline_path/include ${CPPFLAGS}"
export LDFLAGS="-L$readline_path/lib ${LDFLAGS}"

local openssl_path=$(homebrew_package_path openssl)
export CPPFLAGS="-I$openssl_path/include ${CPPFLAGS}"
export LDFLAGS="-L$openssl_path/lib ${LDFLAGS}"

./configure $configure_options || exit 1
make -j $ASDF_CONCURRENCY || exit 1
make -j $ASDF_CONCURRENCY install || exit 1

I referenced pyenv's source for this fix. I wonder if a better solution would be to make this plugin a wrapper around python-build.

@danhper
Copy link
Collaborator

danhper commented Aug 30, 2016

Hi, sorry for the late reply, and thank you for the heads-up!

I also think wrapping python-build seems more appropriate,
as they already probably dealt with all kind of issues.
I will try to update the plugin when I find the time!

@danhper
Copy link
Collaborator

danhper commented Aug 30, 2016

I just updated the plugin to wrap python-build, please let me know how it works for you.

@yaychris
Copy link
Author

yaychris commented Sep 1, 2016

Just tried it out and worked great for me. Great work. Thanks!

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

No branches or pull requests

2 participants