Skip to content

Commit 6322eda

Browse files
committed
Fail to configure without an LLVM-friendly Python
This addresses issue rust-lang#2720. According to LLVM's documentation, it requires a version of Python between 2.4 and 2.7. Without the proper version, LLVM fails to build with cryptic errors. Prior to this commit, the configure script checked for the `python` command in the environment, but didn't actually check the version, which can cause problems e.g. on Linux distros where the default is Python 3. Now the configure script always prefers to select a more specific version of Python when available, in the order `python2.7` > `python2.6` > `python2` > `python`, and will always check to ensure that the interpreter's version is in the correct range.
1 parent 6e6d20a commit 6322eda

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

configure

+6-1
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,13 @@ fi
311311
step_msg "looking for build programs"
312312

313313
probe_need CFG_PERL perl
314-
probe_need CFG_PYTHON python python2.6 python2 python3
315314
probe_need CFG_CURL curl
315+
probe_need CFG_PYTHON python2.7 python2.6 python2 python
316+
317+
python_version=$($CFG_PYTHON -V 2>&1)
318+
if [ $(echo $python_version | grep -c '^Python 2\.[4567]') -ne 1 ]; then
319+
err "Found $python_version, but LLVM requires Python 2.4-2.7"
320+
fi
316321

317322
# If we have no git directory then we are probably a tarball distribution
318323
# and shouldn't attempt to load submodules

0 commit comments

Comments
 (0)