File tree Expand file tree Collapse file tree 5 files changed +43
-3
lines changed Expand file tree Collapse file tree 5 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,23 @@ than building it.
327
327
. entry ( * target)
328
328
. or_insert_with ( || Target :: from_triple ( & target. triple ) ) ;
329
329
330
+ // compiler-rt c fallbacks for wasm cannot be built with gcc
331
+ if target. contains ( "wasm" )
332
+ && ( build. config . optimized_compiler_builtins ( * target)
333
+ || build. config . rust_std_features . contains ( "compiler-builtins-c" ) )
334
+ {
335
+ let cc_tool = build. cc_tool ( * target) ;
336
+ if !cc_tool. is_like_clang ( ) && !cc_tool. path ( ) . ends_with ( "emcc" ) {
337
+ // emcc works as well
338
+ panic ! (
339
+ "Clang is required to build C code for Wasm targets, got `{}` instead\n \
340
+ this is because compiler-builtins is configured to build C source. Either \
341
+ ensure Clang is used, or adjust this configuration.",
342
+ cc_tool. path( ) . display( )
343
+ ) ;
344
+ }
345
+ }
346
+
330
347
if ( target. contains ( "-none-" ) || target. contains ( "nvptx" ) )
331
348
&& build. no_std ( * target) == Some ( false )
332
349
{
Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ RUN ./install-riscv64-none-elf.sh
55
55
COPY host-x86_64/dist-various-1/install-riscv32-none-elf.sh /build
56
56
RUN ./install-riscv32-none-elf.sh
57
57
58
+ COPY host-x86_64/dist-various-1/install-emscripten.sh /build
59
+ RUN ./install-emscripten.sh
60
+
61
+ # Add Emscripten to PATH
62
+ ENV PATH="/build/emsdk:/build/emsdk/upstream/emscripten:/build/emsdk/node/current/bin:${PATH}"
63
+
58
64
# Suppress some warnings in the openwrt toolchains we downloaded
59
65
ENV STAGING_DIR=/tmp
60
66
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -ex
3
+
4
+ apt-get update
5
+ apt-get install -y --no-install-recommends \
6
+ nodejs \
7
+ default-jre
8
+
9
+ git clone https://github.com/emscripten-core/emsdk.git
10
+ cd emsdk
11
+ ./emsdk install latest
12
+ ./emsdk activate latest
Original file line number Diff line number Diff line change 59
59
CXX_i686_unknown_uefi=clang++-11 \
60
60
CC_x86_64_unknown_uefi=clang-11 \
61
61
CXX_x86_64_unknown_uefi=clang++-11 \
62
+ CC_wasm32_unknown_unknown=clang-11 \
63
+ CXX_wasm32_unknown_unknown=clang++-11 \
64
+ CC_wasm32v1_none=clang-11 \
65
+ CXX_wasm32v1_none=clang++-11 \
62
66
CC=gcc-9 \
63
67
CXX=g++-9
64
68
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ ARG DEBIAN_FRONTEND=noninteractive
4
4
RUN apt-get update && apt-get install -y --no-install-recommends \
5
5
clang-11 \
6
6
llvm-11 \
7
+ gcc-multilib \
7
8
g++ \
8
9
make \
9
10
ninja-build \
@@ -59,8 +60,8 @@ RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0
59
60
tar -xJ
60
61
ENV PATH "$PATH:/wasmtime-v19.0.0-x86_64-linux"
61
62
62
- ENV WASM_TARGETS =wasm32-wasip1
63
- ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \
63
+ ENV WASM_WASIP_TARGET =wasm32-wasip1
64
+ ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_WASIP_TARGET \
64
65
tests/run-make \
65
66
tests/ui \
66
67
tests/mir-opt \
@@ -91,4 +92,4 @@ ENV UEFI_SCRIPT python3 /checkout/x.py --stage 2 build --host='' --target $UEFI_
91
92
python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target i686-unknown-uefi && \
92
93
python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target x86_64-unknown-uefi
93
94
94
- ENV SCRIPT $WASM_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT
95
+ ENV SCRIPT $WASM_WASIP_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT
You can’t perform that action at this time.
0 commit comments