Open oligamiq opened 1 month ago
@oligamiq oh, "great". can you specify what command you ran to get that error message?
Ah, I was trying to compile Cargo with wasip1-threads. I think the same error would still occur if I remove the patch I applied to rustc, but the scale is too large, so it might not be helpful as a reference.
Huh! Is there a smaller project that can produce this error? Is it any one crate, or only one with dependencies?
However, the cc object generated by sys is linked to the arguments following --target wasm32-wasi, so it might be reproducible if sys is available. My guess is that the binary needs to be compiled for wasm32-wasip1-threads, including the sys library. Below is the full error message.
libsqlite3-sys seems to use the cc crate for compiling C code. Cc doesn't seem to have special handling for wasm32-wasi-threads. Did you set WASI_SYSROOT correctly for wasm32-wasi-threads? The cc crate uses that to pass to clang when set.
I set the environment variables and applied a patch that adds the pthreads flag. When I switched back to wasm32-wasi-threads, I was able to compile as before, so this was the cause.
I was just trying to create a small example, but it doesn't include --target in the first place. Do you know why --target is included?
about /compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs#L61 now:
I think:
--target wasm32-wasi: After this argument, the linked .o files are treated as wasm32-wasi.
If you change it, it will be linkable.
Meta
rustc --version --verbose
: