wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Fail to link after remove `dlmalloc.o` from `libc.a`
about doc/pthread_library.md
dlmalloc.c define some alias functions and posix_memalign
. Fail to link after remove dlmalloc.o
from libc.a
.
[build] wasm-ld: error: /opt/wasi-sdk-14.0/bin/../share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a(stdlib_new_delete.cpp.o): undefined symbol: posix_memalign
[build] wasm-ld: error: /opt/wasi-sdk-14.0/bin/../share/wasi-sysroot/lib/wasm32-wasi/libc.a(atexit.o): undefined symbol: __libc_calloc
[build] wasm-ld: error: /opt/wasi-sdk-14.0/bin/../share/wasi-sysroot/lib/wasm32-wasi/libc.a(freelocale.o): undefined symbol: __libc_free
[build] wasm-ld: error: /opt/wasi-sdk-14.0/bin/../share/wasi-sysroot/lib/wasm32-wasi/libc.a(locale_map.o): undefined symbol: __libc_malloc
[build] wasm-ld: error: /opt/wasi-sdk-14.0/bin/../share/wasi-sysroot/lib/wasm32-wasi/libc.a(locale_map.o): undefined symbol: __libc_malloc
Hi, have you added the -Wl,--allow-undefined,--no-check-features
option to wasi-sdk?
Hi, have you added the
-Wl,--allow-undefined,--no-check-features
option to wasi-sdk?
I manage import symbols with linker options -Wl,--allow-undefined-file=import_symbols.txt
, unexpected undefined symbols are not acceptable. posix_memalign
had been register in lib_pthread_wrapper.c
.
I fixed it by register other wrapper functions in libc_builtin_wrapper.c
.
just like
static uint32
__libc_calloc_wrapper(Wasm_exec_env_t exec_env, uint32 nmemb, uint32 size)
{
return calloc_wrapper(exec_env, nmemb, size);
}