You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The easiest way to obtain these targets is cross-compilation but native build from `x86_64-pc-windows-gnu` is possible with few hacks which I don't recommend.
19
+
The easiest way to obtain these targets is cross-compilation, but native build from `x86_64-pc-windows-gnu` is possible with few hacks which I don't recommend.
19
20
Std support is expected to be on pair with `*-pc-windows-gnu`.
20
21
21
22
Binaries for this target should be at least on pair with `*-pc-windows-gnu` in terms of requirements and functionality.
22
23
23
24
Those targets follow Windows calling convention for `extern "C"`.
24
25
25
-
Like with any other Windows target created binaries are in PE format.
26
+
Like with any other Windows target, created binaries are in PE format.
26
27
27
28
## Building the target
28
29
29
-
For cross-compilation I recommend using [llvm-mingw](https://github.com/mstorsjo/llvm-mingw) toolchain, one change that seems necessary beside configuring cross compilers is disabling experimental `m86k` target. Otherwise LLVM build fails with `multiple definition ...` errors.
30
-
Native bootstrapping builds require rather fragile hacks until host artifacts are available so I won't describe them here.
30
+
These targets can be easily cross-compiled
31
+
using [llvm-mingw](https://github.com/mstorsjo/llvm-mingw) toolchain or [MSYS2 CLANG*](https://www.msys2.org/docs/environments/) environments.
32
+
Just fill `[target.*]` sections for both build and resulting compiler and set installation prefix in `config.toml`.
33
+
Then run `./x.py install`.
34
+
In my case I had ran `./x.py install --host x86_64-pc-windows-gnullvm --target x86_64-pc-windows-gnullvm` inside MSYS2 MINGW64 shell
35
+
so `x86_64-pc-windows-gnu` was my build toolchain.
36
+
37
+
Native bootstrapping is doable in two ways:
38
+
- cross-compile gnullvm host toolchain and use it as build toolchain for the next build,
39
+
- copy libunwind libraries and rename them to mimic libgcc like here: https://github.com/msys2/MINGW-packages/blob/68e640756df2df6df6afa60f025e3f936e7b977c/mingw-w64-rust/PKGBUILD#L108-L109, stage0 compiler will be mostly broken but good enough to build the next stage.
40
+
41
+
The second option might stop working anytime, so it's not recommended.
31
42
32
43
## Building Rust programs
33
44
34
-
Rust does not yet ship pre-compiled artifacts for this target. To compile for
35
-
this target, you will either need to build Rust with the target enabled (see
36
-
"Building the target" above), or build your own copy of `core` by using
37
-
`build-std` or similar.
45
+
Rust does ship a pre-compiled std library for those targets.
46
+
That means one can easily cross-compile for those targets from other hosts if C proper toolchain is installed.
47
+
48
+
Alternatively full toolchain can be built as described in the previous section.
38
49
39
50
## Testing
40
51
41
52
Created binaries work fine on Windows or Wine using native hardware. Testing AArch64 on x86_64 is problematic though and requires spending some time with QEMU.
42
-
Once these targets bootstrap themselves on native hardware they should pass Rust testsuite.
53
+
Most of x86_64 testsuite does pass when cross-compiling,
54
+
with exception for `rustdoc` and `ui-fulldeps` that fail with and error regarding a missing library,
55
+
they do pass in native builds though.
56
+
The only failing test is std's `process::tests::test_proc_thread_attributes` for unknown reason.
43
57
44
58
## Cross-compilation toolchains and C code
45
59
46
-
Compatible C code can be built with Clang's `aarch64-pc-windows-gnu`, `i686-pc-windows-gnullvm` and `x86_64-pc-windows-gnu` targets as long as LLVMbased C toolchains are used.
60
+
Compatible C code can be built with Clang's `aarch64-pc-windows-gnu`, `i686-pc-windows-gnullvm` and `x86_64-pc-windows-gnu` targets as long as LLVM-based C toolchains are used.
0 commit comments