wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Link libc++ statically to reduce runtime dependency of wamrc
@xujuntwt95329 @yamt I'm trying to make wamrc
compatible with different linux distributions like https://github.com/WebAssembly/wasi-sdk/releases.
I thinks it's useful since we also provide prebuilt binary for wamrc.
@xujuntwt95329 @yamt I'm trying to make
wamrc
compatible with different linux distributions like https://github.com/WebAssembly/wasi-sdk/releases.I thinks it's useful since we also provide prebuilt binary for wamrc.
@no1wudi it sounds good to me, but it increases the wamrc binary size. Could we link the static gcc/g++ lib only for the CI prebuilt binaries and keep it unchanged for normal compilation? Not sure whether it is easy to achieve that?
I guess libc++ is a basement for every platform. If there are compatible issues with a dynamic libc++ library, it highly likely suggests there is a real compatible issue with the platform(via libc++). Using a static library may let wamrc run, but also covers some real problems, I am afraid.
Please refer to widely used wasi-sdk and llvm does if you have any concerns: https://github.com/llvm/llvm-project/blob/de3e4a9dfe89dfc0a4d6d5e0891c542f6c82ca57/llvm/cmake/modules/HandleLLVMStdlib.cmake#L35
https://github.com/WebAssembly/wasi-sdk/blob/99abb024209dc7a9a8d8f3eb6d03908a18bb0594/Makefile#L84
Static link stdc++ should be except increase the binary size, the real problem is glibc, it's can not be linked statically.
The wasi-sdk build the toolchain on older version system (glibc, Ubuntu-18), so if glibc version in your system higher than it then you can run it.
Please refer to widely used wasi-sdk and llvm does if you have any concerns: https://github.com/llvm/llvm-project/blob/de3e4a9dfe89dfc0a4d6d5e0891c542f6c82ca57/llvm/cmake/modules/HandleLLVMStdlib.cmake#L35
https://github.com/WebAssembly/wasi-sdk/blob/99abb024209dc7a9a8d8f3eb6d03908a18bb0594/Makefile#L84
Static link stdc++ should be except increase the binary size, the real problem is glibc, it's can not be linked statically.
The wasi-sdk build the toolchain on older version system (glibc, Ubuntu-18), so if glibc version in your system higher than it then you can run it.
i can understand about libstdc++. but do you have any specific concerns about libgcc?
also, can you answer this question? https://github.com/bytecodealliance/wasm-micro-runtime/pull/3331#discussion_r1569987973
Please refer to widely used wasi-sdk and llvm does if you have any concerns: https://github.com/llvm/llvm-project/blob/de3e4a9dfe89dfc0a4d6d5e0891c542f6c82ca57/llvm/cmake/modules/HandleLLVMStdlib.cmake#L35 https://github.com/WebAssembly/wasi-sdk/blob/99abb024209dc7a9a8d8f3eb6d03908a18bb0594/Makefile#L84 Static link stdc++ should be except increase the binary size, the real problem is glibc, it's can not be linked statically. The wasi-sdk build the toolchain on older version system (glibc, Ubuntu-18), so if glibc version in your system higher than it then you can run it.
i can understand about libstdc++. but do you have any specific concerns about libgcc?
also, can you answer this question? #3331 (comment)
Maybe libgcc is not a problem for this case, but I'm not sure will it lead to compatibility issue in early test so it static linked here, we can remove it after more test.