我有一个Rust项目,我正在按照http://asquera.de/blog/2017-04-10/the-path-to-rust-on-the-web/的步骤将其编译为WebAssembly。该项目已经成功编译。但是当我在Chrome Canary中运行它时,它会因内存不足而崩溃,并给出一个非常有用的错误信息。请看下面的内容:
abort("Cannot enlarge memory arrays. Either (1) compile with -s
TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile
with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime,
...
问题是,如何将这些标志传递给rustc /构建工具链不太清楚。
无论设置EMMAKEN_CFLAGS还是以下操作都不起作用:
cargo rustc -v --target=wasm32-unknown-emscripten --release -- -Clink-args="-s TOTAL_MEMORY=33554432"
-C linker =
将链接器传递给rustc会发生什么? - MB-F