Auto merge of #34515 - alexcrichton:more-checks, r=brson
configure: Check for valid Python on MinGW as well The LLVM build system is somewhat picky about which Python is used to build it as it's known to be incompatible with the default `python2` package that ships with MinGW. This was previously detected for MSVC builds but the logic was left out for MinGW by accident (now that we've switched to cmake builds for LLVM everywhere). This corrects the `./configure` check and also updates the `README.md` accordingly. Additionally, a number of instructions were updated to work with the most recent copy of MSYS2. Closes https://github.com/rust-lang/rust/issues/28260 Closes #34489
This commit is contained in:
commit
2b59647fae
46
README.md
46
README.md
@ -64,37 +64,37 @@ build.
|
|||||||
|
|
||||||
#### MinGW
|
#### MinGW
|
||||||
|
|
||||||
[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows:
|
[MSYS2][msys2] can be used to easily build Rust on Windows:
|
||||||
|
|
||||||
1. Grab the latest MSYS2 installer and go through the installer.
|
msys2: https://msys2.github.io/
|
||||||
|
|
||||||
2. From the MSYS2 terminal, install the `mingw64` toolchain and other required
|
1. Grab the latest [MSYS2 installer][msys2] and go through the installer.
|
||||||
tools.
|
|
||||||
|
2. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed
|
||||||
|
MSYS2 (i.e. `C:\msys64`), depending on whether you want 32-bit or 64-bit
|
||||||
|
Rust. (As of the latest version of MSYS2 you have to run `msys2_shell.cmd
|
||||||
|
-mingw32` or `msys2_shell.cmd -mingw64` from the command line instead)
|
||||||
|
|
||||||
|
3. From this terminal, install the required tools:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
|
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
|
||||||
$ pacman -Sy pacman-mirrors
|
$ pacman -Sy pacman-mirrors
|
||||||
|
|
||||||
|
# Install build tools needed for Rust. If you're building a 32-bit compiler,
|
||||||
|
# then replace "x86_64" below with "i686". If you've already got git, python,
|
||||||
|
# or CMake installed and in PATH you can remove them from this list. Note
|
||||||
|
# that it is important that the `python2` and `cmake` packages **not** used.
|
||||||
|
# The build has historically been known to fail with these packages.
|
||||||
|
$ pacman -S git \
|
||||||
|
make \
|
||||||
|
diffutils \
|
||||||
|
mingw-w64-x86_64-python2 \
|
||||||
|
mingw-w64-x86_64-cmake \
|
||||||
|
mingw-w64-x86_64-gcc
|
||||||
```
|
```
|
||||||
|
|
||||||
Download [MinGW from
|
4. Navigate to Rust's source code (or clone it), then configure and build it:
|
||||||
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
|
|
||||||
`version=4.9.x,threads=win32,exceptions=dwarf/seh` flavor when installing. Also, make sure to install to a path without spaces in it. After installing,
|
|
||||||
add its `bin` directory to your `PATH`. This is due to [#28260](https://github.com/rust-lang/rust/issues/28260), in the future,
|
|
||||||
installing from pacman should be just fine.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Make git available in MSYS2 (if not already available on path)
|
|
||||||
$ pacman -S git
|
|
||||||
|
|
||||||
$ pacman -S base-devel
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed
|
|
||||||
MSYS2 (i.e. `C:\msys`), depending on whether you want 32-bit or 64-bit Rust.
|
|
||||||
(As of the latest version of MSYS2 you have to run `msys2_shell.cmd -mingw32`
|
|
||||||
or `msys2_shell.cmd -mingw64` from the command line instead)
|
|
||||||
|
|
||||||
4. Navigate to Rust's source code, configure and build it:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./configure
|
$ ./configure
|
||||||
|
57
configure
vendored
57
configure
vendored
@ -1178,33 +1178,6 @@ do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*-msvc)
|
*-msvc)
|
||||||
# There are some MSYS python builds which will auto-translate
|
|
||||||
# windows-style paths to MSYS-style paths in Python itself.
|
|
||||||
# Unfortunately this breaks LLVM's build system as somewhere along
|
|
||||||
# the line LLVM prints a path into a file from Python and then CMake
|
|
||||||
# later tries to interpret that path. If Python prints a MSYS path
|
|
||||||
# and CMake tries to use it as a Windows path, you're gonna have a
|
|
||||||
# Bad Time.
|
|
||||||
#
|
|
||||||
# Consequently here we try to detect when that happens and print an
|
|
||||||
# error if it does.
|
|
||||||
if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
|
|
||||||
then
|
|
||||||
err "
|
|
||||||
|
|
||||||
python is silently translating windows paths to MSYS paths \
|
|
||||||
and the build will fail if this python is used.
|
|
||||||
|
|
||||||
Either an official python install must be used or an \
|
|
||||||
alternative python package in MinGW must be used.
|
|
||||||
|
|
||||||
If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
|
|
||||||
package instead of python2:
|
|
||||||
|
|
||||||
$ pacman -R python2 && pacman -S mingw-w64-x86_64-python2
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# There are three builds of cmake on windows: MSVC, MinGW and Cygwin
|
# There are three builds of cmake on windows: MSVC, MinGW and Cygwin
|
||||||
# The Cygwin build does not have generators for Visual Studio, so
|
# The Cygwin build does not have generators for Visual Studio, so
|
||||||
# detect that here and error.
|
# detect that here and error.
|
||||||
@ -1288,6 +1261,36 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
|
||||||
|
then
|
||||||
|
# There are some MSYS python builds which will auto-translate
|
||||||
|
# windows-style paths to MSYS-style paths in Python itself.
|
||||||
|
# Unfortunately this breaks LLVM's build system as somewhere along
|
||||||
|
# the line LLVM prints a path into a file from Python and then CMake
|
||||||
|
# later tries to interpret that path. If Python prints a MSYS path
|
||||||
|
# and CMake tries to use it as a Windows path, you're gonna have a
|
||||||
|
# Bad Time.
|
||||||
|
#
|
||||||
|
# Consequently here we try to detect when that happens and print an
|
||||||
|
# error if it does.
|
||||||
|
if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
|
||||||
|
then
|
||||||
|
err "
|
||||||
|
|
||||||
|
python is silently translating windows paths to MSYS paths \
|
||||||
|
and the build will fail if this python is used.
|
||||||
|
|
||||||
|
Either an official python install must be used or an \
|
||||||
|
alternative python package in MinGW must be used.
|
||||||
|
|
||||||
|
If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
|
||||||
|
package instead of python2:
|
||||||
|
|
||||||
|
$ pacman -S mingw-w64-x86_64-python2
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$CFG_PERF" ]
|
if [ -n "$CFG_PERF" ]
|
||||||
then
|
then
|
||||||
HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
|
HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
|
||||||
|
Loading…
Reference in New Issue
Block a user