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

Detect homebrew python and fail #32992

Closed
sophiajt opened this issue Apr 15, 2016 · 8 comments
Closed

Detect homebrew python and fail #32992

sophiajt opened this issue Apr 15, 2016 · 8 comments
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@sophiajt
Copy link
Contributor

Currently, in OS X, if we find homebrew python we'll use it instead of the system python. Unfortunately, this seems to conflict with the lldb python module.

We don't warn the users that this is the case, and instead happily configure homebrew and promptly crash when the user tries to run any of the debuginfo-lldb tests. We should instead warn the user to not use python from homebrew but instead use the system python.

@alexcrichton alexcrichton added A-build T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 15, 2016
@alexcrichton
Copy link
Member

Specifically, the error here (that I'm getting at least) is:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
    import six
ImportError: No module named six
Fatal Python error: PyThreadState_Get: no current thread

(the major part being Fatal Python error: PyThreadState_Get: no current thread)

I personally have no idea what that error means, but I suspect it's because we're using a compiled plugin for lldb which only works against one version of python (presumably) and that version of python is likely the OSX system python.

We should detect this in either or both of the ./configure script and src/bootstrap/build/sanity.rs. Basically on OSX we should only use /usr/bin/python, not anything from /usr/local. An alternative is to run a smoke test to see if the found python works at all and then just error out if it fails.

cc @michaelwoerister, lldb weirdness!

@sophiajt
Copy link
Contributor Author

sophiajt commented Apr 15, 2016

I also tried installing the 'six' module manually, and still was unable to get past the crash with homebrew python.

@michaelwoerister
Copy link
Member

We could also adapt compiletest to always use /usr/bin/python for the LLDB debuginfo tests? I'll look into it. Maybe LLDB even comes with its own Python version that we can fall back on.

@alexcrichton
Copy link
Member

Yeah that may not be a bad idea to just hardcode that for OSX. #32994 worries me though and indicates that even that may be wrong, although it could also just be a problem with our script. If LLDB has its own Python version then we should probably definitely be using that!

@michaelwoerister
Copy link
Member

Changing the version of Python from the one shipping with OSX is unsupported

from http://stackoverflow.com/a/19642204

@sanmai-NL
Copy link

sanmai-NL commented Apr 16, 2016

LLDB does not appear to come with a Python distribution, and explicitly depends on ‘Python 3.5’. I assume they simply depend on the latest minor version of CPython 3.x. Given the proliferation of Python code in the Rust code base, perhaps shipping a minimal Python distribution with a known version that works well across all Python code may cause the least headache.

You can set PYTHON_HOME when building LLDB, see the previous link.

@sophiajt
Copy link
Contributor Author

I'm pretty sure the trouble I was hitting with homebrew was with the 2.x python. It was the one installed as 'python' in /usr/local/bin. Likewise, system Python is 2.7.10 for OS X 10.11.4. I haven't see it use 3.x, yet, though maybe I'm looking in the wrong place?

@alexcrichton
Copy link
Member

I believe we since fixed this by hardcoding that the system python is used for LLDB tests, so I'm gonna close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants