Skip to content

Commit a0c1783

Browse files
committed
rerun: fix wasm --no-modules build failure
1 parent dffc61c commit a0c1783

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pkgs/by-name/re/rerun/package.nix

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# nativeBuildInputs
77
binaryen,
88
lld,
9+
llvmPackages,
910
pkg-config,
1011
protobuf,
1112
rustfmt,
@@ -31,7 +32,6 @@
3132
"map_view"
3233
],
3334
}:
34-
3535
rustPlatform.buildRustPackage (finalAttrs: {
3636
pname = "rerun";
3737
version = "0.24.0";
@@ -99,6 +99,24 @@ rustPlatform.buildRustPackage (finalAttrs: {
9999
nasm
100100
];
101101

102+
# NOTE: Without setting these environment variables the web-viewer
103+
# preBuild step uses the nix wrapped CC which doesn't support
104+
# multiple targets including wasm32-unknown-unknown. These are taken
105+
# from the following issue discussion in the rust ring crate:
106+
# https://github.com/briansmith/ring/discussions/2581#discussioncomment-14096969
107+
env =
108+
let
109+
inherit (llvmPackages) clang-unwrapped;
110+
major-version = builtins.head (builtins.splitVersion clang-unwrapped.version);
111+
# resource dir + builtins from the unwrapped clang
112+
resourceDir = "${lib.getLib clang-unwrapped}/lib/clang/${major-version}";
113+
includeDir = "${lib.getLib llvmPackages.libclang}/lib/clang/${major-version}/include";
114+
in
115+
{
116+
CC_wasm32_unknown_unknown = lib.getExe clang-unwrapped;
117+
CFLAGS_wasm32_unknown_unknown = "-isystem ${includeDir} -resource-dir ${resourceDir}";
118+
};
119+
102120
buildInputs = [
103121
freetype
104122
glib

0 commit comments

Comments
 (0)