Fix clingo source bootstrapping on M1 macs#30894
Conversation
This tweaks the CMake arguments for `clingo-bootstrap` so that CMake finds the host python's `sys.executable` and `sys.prefix`. We know when bootstrapping that we are building against the host python. One question I am not completely sure about is why the logic in the `python` package doesn't get this right already. We should probaby make that work rather than doing this, but I'm putting this up as a demonstrator.
d5c8821 to
fe34bb1
Compare
|
@certik said #30834 fixed things for him, but I believe he’s using a conda python install. This is specifically trying to fix things for a system python. One caveat is that I have the XCode CLI tools installed, which I where I believe the python framework comes from (it has headers etc.) We may need to bootstrap that too (I noticed that homebrew bootstraps it). @adamjstewart want to try this? |
|
I just clarified in #28190 (comment) that Spack now works for me without Conda as well now, using system Python. (Things have always worked with Conda, that was never an issue.) Update: I just noticed I have this in my export SPACK_PYTHON=$HOME/mambaforge/envs/spack/bin/pythonSo I guess I am still using Conda's Python. Sorry about that. (I did remove |
|
I can confirm that this PR works. I'm using the full XCode suite + CLI tools and Looking at the flags we pass to cmake, there are two differences:
I tried only switching 2 but that didn't help, so I believe that 1 is the change that matters. Using the system Python: $ /usr/bin/python3
Python 3.8.9 (default, Apr 13 2022, 08:48:06)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> sys.executable
'/Applications/Xcode.app/Contents/Developer/usr/bin/python3'
>>> os.path.realpath('/Applications/Xcode.app/Contents/Developer/usr/bin/python3')
'/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3.8'The former is what is used in this PR and works. The latter is what is used on develop and doesn't work. So the question I have is, if I use |
|
I want to test this too --- is it safe to move |
|
Yes, that should work |
|
Ok, I can confirm that this PR works with just command line tools, system Python and no Xcode. |
|
I can also confirm that the |
|
@tgamblin is this PR still necessary? |
|
superseded by #30834 |
Follow-on to #30834.
This tweaks the CMake arguments for
clingo-bootstrapso that CMake finds the host python'ssys.executableandsys.prefix. We know when bootstrapping that we are building against the host python.One question I am not completely sure about is why the logic in the
pythonpackage doesn't get this right already. We should probaby make that work rather than doing this, but I'm putting this up as a demonstrator.@adamjstewart thoughts on that last point?