You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to build rust code as a library to link into a WebAssembly program. The linking happens completely outside the context of Rust using LLVM's wasm-ld.
I expected to see this happen: libc is not included in the archive
Instead, this happened: libc is included in the archive
Either with or without crt-static, libc is included. When I try to actually link into the WebAssembly program, symbols like malloc cause duplicate symbol errors.
#72274 seems to be related - given the checkboxes, my understanding is rust was already fixed to not bundle in libc for static archives to allow linking the library with libc later. Should it be enough to set RUSTFLAGS "-C target-feature=-crt-static" to get a static library without libc?
After looking closer at the symbols, I realized the libc I was seeing is the rust libc crate, not libc itself. The duplicate symbols were triggered by adding the rust library but were not actually because of it, so no problem. Sorry for the noise.
I am trying to build rust code as a library to link into a WebAssembly program. The linking happens completely outside the context of Rust using LLVM's
wasm-ld
.The project is at https://github.com/anuraaga/coraza-wasm-filter
(The code including the patch applied by the Dockerfile is at https://github.com/anuraaga/aho-corasick/tree/wasi-build)
I expected to see this happen:
libc
is not included in the archiveInstead, this happened:
libc
is included in the archiveEither with or without
crt-static
,libc
is included. When I try to actually link into the WebAssembly program, symbols likemalloc
cause duplicate symbol errors.#72274 seems to be related - given the checkboxes, my understanding is rust was already fixed to not bundle in
libc
for static archives to allow linking the library with libc later. Should it be enough to setRUSTFLAGS "-C target-feature=-crt-static"
to get a static library without libc?Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: