Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile with STANDALONE_WASM #358

Open
syrusakbary opened this issue Sep 22, 2019 · 2 comments
Open

How to compile with STANDALONE_WASM #358

syrusakbary opened this issue Sep 22, 2019 · 2 comments

Comments

@syrusakbary
Copy link

I've been trying to play with the new emscripten option STANDALONE_WASM (from emscripten-core/emscripten#9461 ), but all my attempts have been unsuccessful.

How STANDALONE_WASM can be enabled with the emsdk?

I tried so far:

Incoming SDK

./emsdk install sdk-incoming-64bit
./emsdk activate sdk-incoming-64bit

# and then
source ./emsdk_env.sh

But then, when trying to compile I got this error:

➜  tests git:(incoming) emcc hello_world.cpp -s STANDALONE_WASM=1
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/Users/syrusakbary/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO:  - ok
shared:INFO: (Emscripten: Running sanity checks)
shared:ERROR: STANDALONE_WASM is only available in the upstream wasm backend path

Mix incoming/upstream

Then, I activated upstream:

./emsdk install latest-upstream
./emsdk activate latest-upstream

Changing the ~/.emscripten file, to have incoming:

import os
LLVM_ROOT = '/Users/syrusakbary/Development/emsdk/upstream/bin'
# EMSCRIPTEN_ROOT = '/Users/syrusakbary/Development/emsdk/upstream/emscripten'
EMSCRIPTEN_ROOT = '/Users/syrusakbary/Development/emsdk/emscripten/incoming'
EMSCRIPTEN_NATIVE_OPTIMIZER = '/Users/syrusakbary/Development/emsdk/emscripten/incoming_64bit_optimizer/optimizer'
BINARYEN_ROOT = '/Users/syrusakbary/Development/emsdk/upstream'
NODE_JS = '/Users/syrusakbary/Development/emsdk/node/12.9.1_64bit/bin/node'
SPIDERMONKEY_ENGINE = ''
V8_ENGINE = ''
TEMP_DIR = '/var/folders/l5/vjn0dbf96fx3rd6d2vx2mcxm0000gn/T'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]

But still fails:

➜  tests git:(incoming) emcc hello_world.cpp -o hello.wasm
cache:INFO: generating system library: libc.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libcompiler_rt.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libcompiler_rt.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc-wasm.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libc-wasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libdlmalloc.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libdlmalloc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libpthreads_stub.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libpthreads_stub.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libcompiler_rt_wasm.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libcompiler_rt_wasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc_rt_wasm.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libc_rt_wasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libstandalonewasm.a... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/libstandalonewasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/Users/syrusakbary/.emscripten_cache/wasm-obj/generated_struct_info.json" for subsequent builds)
cache:INFO:  - ok
Unknown option '--standalone-wasm'
shared:ERROR: '/Users/syrusakbary/Development/emsdk/upstream/bin/wasm-emscripten-finalize /var/folders/l5/vjn0dbf96fx3rd6d2vx2mcxm0000gn/T/emscripten_temp_SyKPuo/hello.wasm -o /var/folders/l5/vjn0dbf96fx3rd6d2vx2mcxm0000gn/T/emscripten_temp_SyKPuo/hello.wasm.o.wasm --detect-features --no-legalize-javascript-ffi --global-base=1024 --standalone-wasm' failed (1)

Any idea on how can I start using it?

@kripken
Copy link
Member

kripken commented Sep 22, 2019

This option hasn't reached a tagged version yet - it landed friday, and we haven't tagged a release since that time.

You can however use a tip-of-tree build to try it, tot-upstream instead of latest-upstream.

@syrusakbary
Copy link
Author

Thanks!

vargaz pushed a commit to vargaz/emsdk that referenced this issue Nov 22, 2023
…609.8 (emscripten-core#358)

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Helix.Sdk
 From Version 8.0.0-beta.23302.3 -> To Version 8.0.0-beta.23309.8

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants