Skip to content

Commit 810a36b

Browse files
authored
Update EMSDK to 5.0.0 (#479)
Emscripten 4.0.12 introduced breaking change by changing module factory to always return promise even if `WASM_ASYNC_COMPILATION=0`. To overcome this, build emscripten compiler without MODULARIZE with custom export of `createRevive`.
1 parent 71d584d commit 810a36b

File tree

9 files changed

+19
-6
lines changed

9 files changed

+19
-6
lines changed

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ rustflags = [
55
"-Clink-arg=-sEXIT_RUNTIME=1",
66
"-Clink-arg=-sALLOW_MEMORY_GROWTH=1",
77
"-Clink-arg=-sEXPORTED_RUNTIME_METHODS=FS,callMain,stringToNewUTF8",
8-
"-Clink-arg=-sMODULARIZE=1",
9-
"-Clink-arg=-sEXPORT_NAME=createRevive",
108
"-Clink-arg=-sWASM_ASYNC_COMPILATION=0",
9+
"-Clink-arg=--extern-pre-js=js/emscripten/embed/extern-pre.js",
10+
"-Clink-arg=--extern-post-js=js/emscripten/embed/extern-post.js",
1111
"-Clink-arg=-sDYNAMIC_EXECUTION=0",
1212
"-Clink-arg=-sALLOW_TABLE_GROWTH=1",
1313
"-Clink-arg=--js-library=js/emscripten/embed/soljson_interface.js",

.github/actions/get-emsdk/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ inputs:
33
version:
44
description: ""
55
required: false
6-
default: "4.0.9"
6+
default: "5.0.0"
77

88

99
runs:

.github/workflows/release-llvm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ jobs:
7979
rustflags: ""
8080
cache-key: ${{ matrix.target }}
8181

82+
- name: Enable long paths (Windows)
83+
if: runner.os == 'Windows'
84+
run: git config --system core.longpaths true
85+
8286
- name: Install Dependencies
8387
if: ${{ matrix.host == 'linux' }}
8488
run: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This is a development pre-release.
1818
- Updated `musl` to `1.2.5`
1919
- Updated `inkwell` to `0.8.0`
2020
- Updated `polkavm-*` to `0.31.0`
21+
- Updated `EMSDK` to `5.0.0`
2122

2223
## v1.0.0
2324

crates/llvm-builder/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub const MUSL_SNAPSHOTS_URL: &str = "https://git.musl-libc.org/cgit/musl/snapsh
3838
pub const EMSDK_SOURCE_URL: &str = "https://github.com/emscripten-core/emsdk.git";
3939

4040
/// The emscripten SDK version.
41-
pub const EMSDK_VERSION: &str = "4.0.9";
41+
pub const EMSDK_VERSION: &str = "5.0.0";
4242

4343
/// The subprocess runner.
4444
///

js/emscripten/embed/extern-post.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return Module;
2+
}
3+
if (typeof module === "object" && typeof module.exports === "object") {
4+
module.exports = createRevive;
5+
} else if (typeof define === "function" && define["amd"])
6+
define([], () => createRevive);

js/emscripten/embed/extern-pre.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
function createRevive(moduleArg) {
2+
var Module = moduleArg || {};

js/emscripten/examples/node/revive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const soljson = require("solc/soljson");
22
const createRevive = require("./resolc.js");
33

4-
async function compile(standardJsonInput) {
4+
function compile(standardJsonInput) {
55
if (!standardJsonInput) {
66
throw new Error("Input JSON for the Solidity compiler is required.");
77
}

js/emscripten/examples/web/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importScripts("./resolc_web.js");
22

33
// Handle messages from the main thread
4-
onmessage = async function (e) {
4+
onmessage = function (e) {
55
const m = createRevive();
66

77
// Set input data for stdin

0 commit comments

Comments
 (0)