From 57745199aaa9339109bd1f223d10230c93e46dfb Mon Sep 17 00:00:00 2001 From: scroggo Date: Fri, 29 Nov 2024 10:35:45 -0500 Subject: [PATCH 1/2] Add missing rustflags for exporting to web According to [a message in the Discord server](https://discord.com/channels/723850269347283004/1311869218572210207/1312024661860683847), you probably need some [more flags](https://discord.com/channels/723850269347283004/1274080437198651546/1275336695264575542) in order to properly export to the web. In my experience, this makes it work! I have not tested to verify whether this is the exact set needed, or a superset. --- src/toolchain/export-web.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/toolchain/export-web.md b/src/toolchain/export-web.md index d2e34d2..21e9724 100644 --- a/src/toolchain/export-web.md +++ b/src/toolchain/export-web.md @@ -74,7 +74,13 @@ rustflags = [ "-C", "link-args=-sSIDE_MODULE=2", "-C", "link-args=-pthread", # was -sUSE_PTHREADS=1 in earlier emscripten versions "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals", - "-Zlink-native-libraries=no" + "-Zlink-native-libraries=no", + "-Clink-arg=-fwasm-exceptions", + "-Clink-args=-sDISABLE_EXCEPTION_CATCHING=1", + "-Clink-args=-sEXPORT_ALL=1", + "-Clink-args=-sSUPPORT_LONGJMP=wasm", + "-Cllvm-args=-enable-emscripten-cxx-exceptions=0", + "-Cllvm-args=-wasm-enable-sjlj", ] ``` From af207f897c9250550a851d289f365e7b05268872 Mon Sep 17 00:00:00 2001 From: scroggo Date: Fri, 6 Dec 2024 11:11:31 -0500 Subject: [PATCH 2/2] Remove extraneous `rustflags` --- src/toolchain/export-web.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/toolchain/export-web.md b/src/toolchain/export-web.md index 21e9724..fbc7183 100644 --- a/src/toolchain/export-web.md +++ b/src/toolchain/export-web.md @@ -75,12 +75,7 @@ rustflags = [ "-C", "link-args=-pthread", # was -sUSE_PTHREADS=1 in earlier emscripten versions "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals", "-Zlink-native-libraries=no", - "-Clink-arg=-fwasm-exceptions", - "-Clink-args=-sDISABLE_EXCEPTION_CATCHING=1", - "-Clink-args=-sEXPORT_ALL=1", - "-Clink-args=-sSUPPORT_LONGJMP=wasm", "-Cllvm-args=-enable-emscripten-cxx-exceptions=0", - "-Cllvm-args=-wasm-enable-sjlj", ] ```