Skip to content

Commit e033e7c

Browse files
committed
envoy: fix up Rust builds
This unblocks using wasmtime rather than wamr as the WASM runtime in envoy (see NixOS#425065).
1 parent 0d58fdb commit e033e7c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

pkgs/by-name/en/envoy/bazel_nix.BUILD.bazel

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
load("@bazel_tools//tools/sh:sh_toolchain.bzl", "sh_toolchain")
22
load("@rules_rust//rust:toolchain.bzl", "rust_toolchain")
3+
load("@rules_rust//rust:defs.bzl", "rust_stdlib_filegroup")
34

45
toolchains = {
56
"x86_64": "x86_64-unknown-linux-gnu",
67
"aarch64": "aarch64-unknown-linux-gnu",
78
}
89

9-
exports_files(["cargo", "rustdoc", "ruststd", "rustc"])
10+
exports_files(["cargo", "rustdoc", "rustc"])
11+
12+
[
13+
rust_stdlib_filegroup(
14+
name = "rust_nix_" + k + "_stdlib",
15+
srcs = glob(
16+
[
17+
"rustcroot/lib/rustlib/" + v + "/lib/**",
18+
],
19+
allow_empty=True,
20+
),
21+
)
22+
for k, v in toolchains.items()
23+
]
1024

1125
[
1226
rust_toolchain(
@@ -16,7 +30,7 @@ exports_files(["cargo", "rustdoc", "ruststd", "rustc"])
1630
exec_triple = v,
1731
cargo = ":cargo",
1832
rust_doc = ":rustdoc",
19-
rust_std = ":ruststd",
33+
rust_std = ":rust_nix_" + k + "_stdlib",
2034
rustc = ":rustc",
2135
stdlib_linkflags = ["-ldl", "-lpthread"],
2236
staticlib_ext = ".a",

pkgs/by-name/en/envoy/package.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ buildBazelPackage rec {
9494
ln -sf "${cargo}/bin/cargo" bazel/nix/cargo
9595
ln -sf "${rustc}/bin/rustc" bazel/nix/rustc
9696
ln -sf "${rustc}/bin/rustdoc" bazel/nix/rustdoc
97-
ln -sf "${rustPlatform.rustLibSrc}" bazel/nix/ruststd
97+
ln -sf "${rustc.unwrapped}" bazel/nix/rustcroot
9898
substituteInPlace bazel/dependency_imports.bzl \
9999
--replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \
100100
--replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",'
@@ -239,6 +239,7 @@ buildBazelPackage rec {
239239
"--linkopt=-Wl,-z,noexecstack"
240240
"--config=gcc"
241241
"--verbose_failures"
242+
"--incompatible_enable_cc_toolchain_resolution=true"
242243

243244
# Force use of system Java.
244245
"--extra_toolchains=@local_jdk//:all"

0 commit comments

Comments
 (0)