From 17ad80f57ebf07e4bcbfa148579dff6bdf5b5713 Mon Sep 17 00:00:00 2001 From: 0riginaln0 <74508026+0riginaln0@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:41:12 +0300 Subject: [PATCH 1/2] compile with --threads:off Update cart.nimble When compiling the cart, an error occurs: Threads not implemented for os:any. Please compile with --threads:off. stack trace: (most recent call last) Added --threads:off flag, for successful compilation of the cart --- cli/assets/templates/nim/cart.nimble | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/assets/templates/nim/cart.nimble b/cli/assets/templates/nim/cart.nimble index 2d5b4409..74381e81 100644 --- a/cli/assets/templates/nim/cart.nimble +++ b/cli/assets/templates/nim/cart.nimble @@ -13,14 +13,14 @@ let outFile = "build" / "cart.wasm" requires "nim >= 1.4.0" task dbg, "Build the cartridge in debug mode": - exec &"nim c -d:nimNoQuit -o:{outFile} src/cart.nim" + exec &"nim c --threads:off -d:nimNoQuit -o:{outFile} src/cart.nim" task rel, "Build the cartridge with all optimizations": - exec &"nim c -d:nimNoQuit -d:danger -o:{outFile} src/cart.nim" + exec &"nim c --threads:off -d:nimNoQuit -d:danger -o:{outFile} src/cart.nim" after rel: let exe = findExe("wasm-opt") if exe != "": exec(&"wasm-opt -Oz --zero-filled-memory --strip-producers {outFile} -o {outFile}") else: - echo "Tip: wasm-opt was not found. Install it from binaryen for smaller builds!" \ No newline at end of file + echo "Tip: wasm-opt was not found. Install it from binaryen for smaller builds!" From d3dab3d4d5b89fa4aa8fbd68b88531251afbfb38 Mon Sep 17 00:00:00 2001 From: 0riginaln0 <74508026+0riginaln0@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:49:23 +0300 Subject: [PATCH 2/2] wasm-opt --enable-bulk-memory Update cart.nimble The build with wasm-opt failed with the error: [wasm-validator error in function 1] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory] Added --enable-bulk-memory flag to the template. --- cli/assets/templates/nim/cart.nimble | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/assets/templates/nim/cart.nimble b/cli/assets/templates/nim/cart.nimble index 74381e81..1635a4f0 100644 --- a/cli/assets/templates/nim/cart.nimble +++ b/cli/assets/templates/nim/cart.nimble @@ -21,6 +21,6 @@ task rel, "Build the cartridge with all optimizations": after rel: let exe = findExe("wasm-opt") if exe != "": - exec(&"wasm-opt -Oz --zero-filled-memory --strip-producers {outFile} -o {outFile}") + exec(&"wasm-opt --enable-bulk-memory -Oz --zero-filled-memory --strip-producers {outFile} -o {outFile}") else: echo "Tip: wasm-opt was not found. Install it from binaryen for smaller builds!"