您当前的位置: 首页 >  ar

phymat.nico

暂无认证

  • 2浏览

    0关注

    1967博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

wasm-ld: error: ‘atomics‘ feature is used by allcodecs.o, so --shared-memory must be used

phymat.nico 发布时间:2020-07-02 11:34:11 ,浏览量:2

Ok, there are a few things happening here due to our incomplete implementation of pthreads+llvm backend in emscripten. Here's how you can hack around them.

wasm-ld: error: 'atomics' feature is used, so --shared-memory must be used

What's happening here is that Emscripten should be passing --shared-memory to the linker because multithreaded applications require a wasm shared memory, but it's not. You can pass this flag manually to the linker with -Wl,--shared-memory.

wasm-ld: error: Target feature 'atomics' is disallowed. Use --no-check-features to suppress.

You're getting this error because emscripten is trying to link your code against a libc (or other library) that contained atomic operations in its source but was compiled for MVP, which caused those atomic operations to be lowered to non-atomic operations. Linking your multithreaded code with these libraries is very dangerous because those libraries will not be thread safe, even if they were supposed to be.

The proper way to handle this is to recompile the libraries you are using with pthreads enabled, but unfortunately Emscripten does not know how to compile its libc with pthreads yet. As the error message says, you can pass --no-check-features to the linker to hack your way past this issue, but that would result in an unexpectedly thread-unsafe final binary.

tl;dr: Pass -Wl,--shared-memory,--no-check-features to make these errors go away, but that's not exactly safe.

 

https://github.com/emscripten-core/emscripten/issues/8503

关注
打赏
1659628745
查看更多评论
立即登录/注册

微信扫码登录

0.0434s