You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have compiled a 'hello world' demo under the instruction of swiftwasm-book. And I found the hello.wasm is very big ( >10MB )。
I think the main reason is that print will be linked to libswiftCore, which size is 9MB。
AFAK, wasi in wasm is just stubs, it is dynamicly linked at runtime. So I'm trying to exclude these at linkage, by using --allow-undefined / --allow-undefined-file=undefined-symbols.txt after wasm-ld. But it doesn't work, error is:
Hi @didi11641, thanks for reporting the issue. As far as I know, neither WebAssembly, nor WASI support dynamic linking, and we don't do any dynamic linking at runtime. Both libswiftCore and WASI are linked statically and are required for SwiftWasm apps to work. libswiftCore contains the standard library and runtime, while WASI and ICU contain basic memory allocation and string manipulation code.
We have more details available about the ongoing effort to reduce the binary size in the related thread in the main SwiftWasm repository. Does that answer your question?
@MaxDesiatov Thanks for your reply. I have looked into print implementation in Print.swift, I guess it will finally call funcs like _swift_stdlib_write in LibcShims.h ,which calls WASI API write。 Thanks for providing the related thread, I will keep track on that issue :)
I have compiled a 'hello world' demo under the instruction of swiftwasm-book. And I found the hello.wasm is very big ( >10MB )。
I think the main reason is that
print
will be linked to libswiftCore, which size is 9MB。AFAK, wasi in wasm is just stubs, it is dynamicly linked at runtime. So I'm trying to exclude these at linkage, by using
--allow-undefined
/--allow-undefined-file=undefined-symbols.txt
afterwasm-ld
. But it doesn't work, error is:I don't know how to resolve this, anyone help?
The text was updated successfully, but these errors were encountered: