首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wasm:错误:初始内存太小,需要18317952字节

wasm:错误:初始内存太小,需要18317952字节
EN

Stack Overflow用户
提问于 2020-08-26 09:59:31
回答 1查看 2.2K关注 0票数 1

我想编译ffmpeg到wasm.After下载FFMPEG和emsdk源代码,我使用下面的命令构建。

代码语言:javascript
复制
emconfigure   ./configure --cc="emcc" --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic \
--disable-ffplay --disable-ffprobe --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network \
--disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file  --ranlib="emranlib" 

emmake make

然后我犯了这样的错误:

代码语言:javascript
复制
emcc: warning: ignoring unsupported linker flag: `-rpath-
link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavfo
rmat:libavcodec:libavutil:libavresample` [-Wlinkflags]
wasm-ld: error: initial memory too small, 18317952 bytes needed
emcc: error: '/home/ubuntu/emsdk/upstream/bin/wasm-ld -o 
/tmp/emscripten_temp_t3l4sg_k/ffmpeg_g.wasm -Llibavcodec -Llibavdevice 
-Llibavfilter -Llibavformat -L/home/ubuntu/emsdk/upstream/emscripten
/system/local/lib -Llibavresample -L/home/ubuntu/emsdk/upstream/emscripten
/system/lib -Llibavutil -L/home/ubuntu/emsdk/upstream/emscripten
/cache/wasm -Llibpostproc -Llibswscale -Llibswresample -z noexecstack 
fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o 
fftools/cmdutils.o fftools/ffmpeg.o libavdevice/libavdevice.a 
libavfilter/libavfilter.a libavformat/libavformat.a 
libavcodec/libavcodec.a libswresample/libswresample.a 
libswscale/libswscale.a libavutil/libavutil.a /home/ubuntu/emsdk/upstream
/emscripten/cache/wasm/libc.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libcompiler_rt.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libc++-noexcept.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libc++abi-noexcept.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libdlmalloc.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libpthread_stub.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libc_rt_wasm.a /home/ubuntu/emsdk/upstream/emscripten/cache
/wasm/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm 
-enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --import-
memory --import-table --strip-debug --export main --export malloc --export 
free --export stackSave --export stackRestore --export stackAlloc --export 
__data_end --export __wasm_call_ctors --export fflush --export 
__errno_location --export _get_tzname --export _get_daylight --export 
_get_timezone --export memalign --export memset -z stack-size=5242880 
--initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed

如何更改默认的initial-memory emcc设置?

EN

回答 1

Stack Overflow用户

发布于 2021-02-05 19:45:36

在这个github问题中有一个答案。

最快的修复方法是将总内存标志设置为-s TOTAL_MEMORY=num_bytes。只需确保您传递的数字是64‘t的倍数,否则它不会编译。

另外,如果您打算更改代码基,我将把它归为“所需字节”的大小可能会更改,在我的示例中,它被绑定为60 my (与此无关的代码)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63595167

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档