Skip to content

Commit 0e3c28c

Browse files
committed
fix(docker): Pin Rust nightly for WASM build compatibility
Rust 1.93+ removed -Zbuild-std support for wasm32-unknown-emscripten. Pin to nightly-2026-01-20 which still supports this feature, required for building cdylib crate type for Godot WASM exports.
1 parent 99c69ed commit 0e3c28c

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

docker/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ ENV EMSDK=/opt/emsdk
2626
ENV PATH="${EMSDK}:${EMSDK}/upstream/emscripten:${PATH}"
2727

2828
# Rust nightly toolchain with targets
29-
RUN rustup toolchain install nightly \
30-
&& rustup target add x86_64-pc-windows-gnu --toolchain nightly \
31-
&& rustup component add rust-src --toolchain nightly
29+
# Pin to nightly-2026-01-20 to avoid breaking change in Rust 1.93+ where
30+
# -Zbuild-std is no longer supported with wasm32-unknown-emscripten target
31+
ENV RUST_NIGHTLY=nightly-2026-01-20
32+
RUN rustup toolchain install $RUST_NIGHTLY \
33+
&& rustup target add x86_64-pc-windows-gnu --toolchain $RUST_NIGHTLY \
34+
&& rustup component add rust-src --toolchain $RUST_NIGHTLY \
35+
&& rustup default $RUST_NIGHTLY
3236

3337
# Copy entrypoint script
3438
COPY build.sh /usr/local/bin/build

docker/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fi
5555

5656
case "$TARGET" in
5757
windows)
58-
cargo +nightly build --manifest-path bindings/godot/Cargo.toml \
58+
cargo build --manifest-path bindings/godot/Cargo.toml \
5959
--target-dir target --target x86_64-pc-windows-gnu $FEATURES $CARGO_PROFILE_FLAG
6060
cp target/x86_64-pc-windows-gnu/$PROFILE/bobbin_godot.dll "$BIN_DIR/bobbin_godot$SUFFIX.dll"
6161
;;
@@ -66,9 +66,9 @@ case "$TARGET" in
6666
# Set rustflags for WASM target (side module for Godot)
6767
export CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUSTFLAGS="-C link-args=-pthread -C target-feature=+atomics -C link-args=-sSIDE_MODULE=2 -C panic=abort -Zlink-native-libraries=no -Cllvm-args=-enable-emscripten-cxx-exceptions=0"
6868
# Use 'wasm' profile (size-optimized, no LTO)
69-
# Note: -Zbuild-std is no longer supported with wasm32-unknown-emscripten target
70-
cargo +nightly build --manifest-path bindings/godot/Cargo.toml \
71-
--target-dir target --profile wasm --target wasm32-unknown-emscripten
69+
# Note: Requires pinned nightly (see Dockerfile) - newer nightlies removed -Zbuild-std support for emscripten
70+
cargo build --manifest-path bindings/godot/Cargo.toml \
71+
-Zbuild-std=std,panic_abort --target-dir target --profile wasm --target wasm32-unknown-emscripten
7272
# Run wasm-opt for aggressive size optimization (more efficient than LTO for WASM)
7373
WASM_FILE="target/wasm32-unknown-emscripten/wasm/bobbin_godot.wasm"
7474
WASM_OPT="$EMSDK/upstream/bin/wasm-opt"
@@ -80,7 +80,7 @@ case "$TARGET" in
8080
cp "$WASM_FILE" "$BIN_DIR/bobbin_godot.wasm"
8181
;;
8282
linux)
83-
cargo +nightly build --manifest-path bindings/godot/Cargo.toml --target-dir target $FEATURES $CARGO_PROFILE_FLAG
83+
cargo build --manifest-path bindings/godot/Cargo.toml --target-dir target $FEATURES $CARGO_PROFILE_FLAG
8484
cp target/$PROFILE/libbobbin_godot.so "$BIN_DIR/libbobbin_godot$SUFFIX.so"
8585
;;
8686
all)

0 commit comments

Comments
 (0)