cc long double targeting wasm32-wasi links incorrectly #74393
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-bug
Category: This is a bug.
O-wasm
Target: WASM (WebAssembly), http://webassembly.org/
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
A Rust crate with C dependency that uses
long double
targetingwasm32-wasi
links incorrectly, while clang can compile such programs to WebAssembly.I tried this code:
I expected to see this happen: the program should run and print a random number, just like when I compile with clang.
Instead, this happened:
Simple repo to reproduce with Docker: https://github.com/TjeuKayim/wasi-long-double
Motivation
I tried to compile rusqlite to WASI following the instructions at https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/wasm32_wasi/index.html. This was one of the issues I ran into. A work-around is to pass this flag
-DLONGDOUBLE_TYPE=double
. The weird thing is that when I compile sqlite with clang and wasi-sdk, it compiles and runs correctly. Also, other projects manage to compile sqlite to WebAssembly, like https://wapm.io/package/sqlite#shell.The text was updated successfully, but these errors were encountered: