diff options
| author | Matoro Mahri <matoro_gentoo@matoro.tk> | 2024-02-09 10:48:17 -0500 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2024-02-10 07:49:17 +0000 |
| commit | 869a67efcaedbf7d08fe16057466f58ac1f21a84 (patch) | |
| tree | b8d944eb302af8b530012de7283694f51a4bdd45 /dev-lang/rust/files/1.74.1-cross-compile-libz.patch | |
| parent | 6c1e3bac4e7b3fdcb3195e053d4979d22ff29ff2 (diff) | |
| download | gentoo-869a67efcaedbf7d08fe16057466f58ac1f21a84.tar.gz gentoo-869a67efcaedbf7d08fe16057466f58ac1f21a84.tar.bz2 gentoo-869a67efcaedbf7d08fe16057466f58ac1f21a84.zip | |
dev-lang/rust: crossdev support
This allows Rust to be cross-compiled with crossdev. This is the last
item for bug 680652, closing it. Note that this is for a foreign CHOST,
i.e., CBUILD != CHOST == CTARGET. It does not cover the scenario for
CBUILD == CHOST != CTARGET(s), which is tracked separately in bug
679878.
A number of changes were required in order to make this work:
* Force USE=system-bootstrap, since we cannot specify the appropriate
boostrap URL based on CBUILD in SRC_URI
* LLVm is compiled twice as part of the build, once for host and once
for target. However, the rust build uses the same settings from
config.toml for both builds. Therefore we cannot override flags nor
default-linker and must let rust choose them for us.
* Set the appropriate build/host variables which correspond to
CBUILD/CHOST. This works as expected.
* Set PKG_CONFIG and OPENSSL_*_DIR variables; cargo needs these for some
reason.
* Enforce that LLVM_TARGETS is set correctly for both host and target
arches. This uses the new llvm_tuple_to_target function, introduced
in https://github.com/gentoo/gentoo/pull/33996
* Lastly a small patch to rust source is needed, to tell it to link with
system libz. It's unclear why this scenario was excluded under
cross-compile conditions in upstream rust.
See: https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
Bug: https://bugs.gentoo.org/679878
Closes: https://bugs.gentoo.org/680652
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/35246
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang/rust/files/1.74.1-cross-compile-libz.patch')
| -rw-r--r-- | dev-lang/rust/files/1.74.1-cross-compile-libz.patch | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/dev-lang/rust/files/1.74.1-cross-compile-libz.patch b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch new file mode 100644 index 000000000000..f2a881b46134 --- /dev/null +++ b/dev-lang/rust/files/1.74.1-cross-compile-libz.patch @@ -0,0 +1,19 @@ +https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22 +https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497 + +diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs +index f606fa483ca..8a2e1c40e8b 100644 +--- a/compiler/rustc_llvm/build.rs ++++ b/compiler/rustc_llvm/build.rs +@@ -237,10 +237,7 @@ fn main() { + // of llvm-config, not the target that we're attempting to link. + let mut cmd = Command::new(&llvm_config); + cmd.arg(llvm_link_arg).arg("--libs"); +- +- if !is_crossed { +- cmd.arg("--system-libs"); +- } ++ cmd.arg("--system-libs"); + + if (target.starts_with("arm") && !target.contains("freebsd")) + || target.starts_with("mips-") |
