Skip to content

I can't make a web build for release #8

Open
@SoftHardcore

Description

@SoftHardcore

I tried compiling the Rust library for the dodge-the-creeps project to obtain the '.wasm' file for both debug and release versions. To do this, I followed the steps from the Export to Web documentation.

I downloaded emscripten and executed all the necessary commands from the documentation:

rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-emscripten --toolchain nightly

./emsdk install 3.1.62
./emsdk activate 3.1.62
source ./emsdk_env.sh # btw, the documentation mentions an outdated command `source ./emsdk.sh`

Then, I tried to build the release version:

cargo +nightly build --release -Zbuild-std --features godot/experimental-wasm,godot/lazy-function-tables --target wasm32-unknown-emscripten

And if for the debug build I had a successful result, then an attempt to compile a build for release with the --release flag at the end of the compilation gave an error:

   ...
   Compiling rand v0.8.5
   Compiling godot v0.2.4 (https://github.com/godot-rust/gdext.git#b0be794c)
   Compiling dodge-the-creeps v0.1.0 (/home/user/projects/ProjectsGodot/dodge-the-creeps/rust)
warning: unstable feature specified for `-Ctarget-feature`: `atomics`
  |
  = note: this feature is not stably supported; its behavior can change in the future

error: linking with `emcc` failed: exit status: 1
  |
  = note:  "emcc" "-s" "EXPORTED_FUNCTIONS=[\"___godot_rust_registrant_1025202362_1350490027\",\"___godot_rust_registrant_1101513929_1801979802\",\"___godot_rust_registrant_1365180540_1540383426\",\"___godot_rust_registrant_1681692777_1714636915\",\"___godot_rust_registrant_1804289383_846930886\",\"___godot_rust_registrant_1957747793_424238335\",\"___godot_rust_registrant_2044897763_1967513926\",\"___godot_rust_registrant_2145174067_468703135\",\"___godot_rust_registrant_278722862_233665123\",\"___godot_rust_registrant_294702567_1726956429\",\"___godot_rust_registrant_304089172_1303455736\",\"___godot_rust_registrant_336465782_861021530\",\"___godot_rust_registrant_35005211_521595368\",\"___godot_rust_registrant_596516649_1189641421\",\"___godot_rust_registrant_719885386_1649760492\",\"___godot_rust_registrant_783368690_1102520059\",\"_gdext_rust_init\"]" "<17 object files omitted>" "/home/user/projects/ProjectsGodot/dodge-the-creeps/rust/target/wasm32-unknown-emscripten/release/deps/{librand-5091c1d6dfbe5787.rlib,librand_chacha-851518d53be850a0.rlib,libppv_lite86-6eb742765e7cd1a7.rlib,libzerocopy-4bc3beda8a77cfdd.rlib,librand_core-f58de05815d27c8c.rlib,libgetrandom-60e8f95502be50c0.rlib,liblibc-b4e3ea87c31890b7.rlib,libcfg_if-fab19221290f8bbb.rlib,libgodot-5088a0b231bce29e.rlib,libgodot_core-7a01f5e16d89c050.rlib,libgodot_cell-2c8ea8db76081be3.rlib,libglam-8e30c70db285be24.rlib,libgodot_ffi-a3dbe1f0968e09be.rlib,libstd-9d21705d1e98481a.rlib,libpanic_unwind-1526744daa4904ad.rlib,librustc_demangle-0da3df4849c5a174.rlib,libstd_detect-37b68885def5b9a1.rlib,libhashbrown-584c659b45052d14.rlib,librustc_std_workspace_alloc-9f86d26d310a9544.rlib,libminiz_oxide-25f87b4cf4f43fcc.rlib,libadler2-107565b3c955937d.rlib,libunwind-eeec7a8114d2e3b6.rlib,libcfg_if-e5d75bb0875b4c00.rlib,liblibc-a1f0f269d50a87aa.rlib,liballoc-c50c0616ecc39485.rlib,librustc_std_workspace_core-ac9f390e10f3ae53.rlib,libcore-0a0a0ec040161aba.rlib,libcompiler_builtins-74d69639f1ae3b8a.rlib}.rlib" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "--target=wasm32-unknown-emscripten" "-sDISABLE_EXCEPTION_CATCHING=0" "-o" "/home/user/projects/ProjectsGodot/dodge-the-creeps/rust/target/wasm32-unknown-emscripten/release/deps/dodge_the_creeps.wasm" "-O3" "-g0" "-pthread" "-sSIDE_MODULE=2" "-sABORTING_MALLOC=0" "-sWASM_BIGINT"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: emcc: warning: -sSIDE_MODULE + pthreads is experimental [-Wexperimental]
          Unknown option '--enable-bulk-memory-opt'
          emcc: error: '/home/user/APPS/Godot/utils/emsdk-4.0.7/upstream/bin/wasm-opt --strip-target-features --post-emscripten --pass-arg=post-emscripten-side-module -O3 --low-memory-unused --pass-arg=directize-initial-contents-immutable /home/user/projects/ProjectsGodot/dodge-the-creeps/rust/target/wasm32-unknown-emscripten/release/deps/dodge_the_creeps.wasm -o /home/user/projects/ProjectsGodot/dodge-the-creeps/rust/target/wasm32-unknown-emscripten/release/deps/dodge_the_creeps.wasm --mvp-features --enable-threads --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext' failed (returned 1)
          

warning: `dodge-the-creeps` (lib) generated 1 warning
error: could not compile `dodge-the-creeps` (lib) due to 1 previous error; 1 warning emitted

In addition to emcc version 3.1.62, I also tried 3.1.73 and the latest version, but without success.

I suspect that I may need to downgrade my Rust version, but I'm not sure how to determine which version of Rust I need. I might also need some other version of emcc, but I also don't know how to figure out which one is required.

I also tried disable multi-threading support, but the error still persists for the release version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions