wasm-ld:错误:初始内存太小,需要18317952字节 [英] wasm-ld: error: initial memory too small, 18317952 bytes needed

查看:223
本文介绍了wasm-ld:错误:初始内存太小,需要18317952字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将ffmpeg编译为wasm.下载FFMPEG和emsdk源代码后,我使用下面的命令进行构建.

I want to compile ffmpeg to wasm.After downloading FFMPEG and emsdk source code,I used command below to build.

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

然后我得到了这样的错误:

then I got such error:

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

如何更改默认的 emcc 初始内存设置?

How can I change the default emcc initial-memory setting?

推荐答案

最快的解决方法是将总内存标志设置为 -s TOTAL_MEMORY = num_bytes .只需确保您传递的数字是64kb的倍数,否则将无法编译.

The quickest fix has been to set the total memory flag to -s TOTAL_MEMORY=num_bytes. Just make sure the number you pass is a multiple of 64kb or it won't compile.

此外,如果您打算更改代码库,我会将其四舍五入为需要的字节数"的大小.可能会更改,在我的情况下,它的大小限制为60MB(用于与此无关的代码).

Also if you intend to alter the codebase I would round up as this size for "bytes needed" may change , in my case it was bound by 60MB (for code unrelated to this).

这篇关于wasm-ld:错误:初始内存太小,需要18317952字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆