simon-git: msvc-extract (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Thu Jan 11 09:05:33 GMT 2024
TL;DR:
102ed00 Initial support for cross-building Rust programs.
Repository: https://git.tartarus.org/simon/msvc-extract.git
On the web: https://git.tartarus.org/?p=simon/msvc-extract.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2024-01-11 09:05:33
commit 102ed006e83a3ddba11668bb72dbaeed0dc10c72
web diff https://git.tartarus.org/?p=simon/msvc-extract.git;a=commitdiff;h=102ed006e83a3ddba11668bb72dbaeed0dc10c72;hp=f8fa676e4dc480e2711d2ea5543aea4ac3209b86
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Jan 11 08:46:54 2024 +0000
Initial support for cross-building Rust programs.
Rust's cross-compilation system _almost_ works out of the box for
building on Linux for Windows. But it fails at the link step, where it
expects to be able to invoke 'link.exe' and have it behave like the
MSVC linker.
But that's easily fixed: make a script called link.exe which invokes
lld with the same command line, having set up LIB to point at the
libraries.
This commit adds a 'rustbin' directory in the msvc-extract tarball,
containing just that script. To run it, you need 'lld-link' on your
path already.
With this change, I've been able to get a successful cross-build of a
Rust program using the following technique:
- start from the official 'rust' Docker image
- apt install lld
- rustup target add x86_64-pc-windows-msvc
- add the 'rustbin' directory from this tarball to PATH
- cargo build --target=x86_64-pc-windows-msvc
However, trying the same thing with aarch64-pc-windows-msvc _doesn't_
work at present: I get a small number of errors of the form 'machine
type x64 conflicts with arm64', citing object files in msvcrt.lib. So
there may be a further bug in this tool which is causing it to find
the wrong version of that library.
But this is a start.
msvc-extract.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
More information about the tartarus-commits
mailing list