-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__extenddftf2
is found to be missing at runtime when Rust's cargo
is driving the build
#361
Comments
It looks like this symbol is asked for if the C code being compiled tries to use Maybe the SDK's compiler just shouldn't provide a distinct |
The version of compiler-rt that ships with wasm-sdk (https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/libclang_rt.builtins-wasm32-wasi-20.0.tar.gz) does seem to define it:
|
Hmmm. It does look like the symbol is in Is it possible that the linking step for my C code is missing I'm not having problems with missing pieces of normal |
I'd be very surprised if compiler-rt was not being included by your the driver since there are many symbols in compiler-rt that are pretty much essential to all programs. Can you get your driver to print the |
The post at https://petermalmgren.com/wasm-components-sqlite-vfs/ shows a more complicated setup for attacking Rust to the SDK than I am using, and suggests using But I tried that:
And even though it's definitely calling the SDK's If I don't use According to
This is apparently calling So I think I am ending up using a compiler builtins library provided by the Rust toolchain somehow, and not the one that C code built with the SDK needs to link against. |
__extenddftf2
is found to be missing at runtime__extenddftf2
is found to be missing at runtime when Rust's cargo
is driving the build
Maybe Also, shouldn't the linker report |
Yes I see |
So this seems like a rust issue and not a wasi-sdk issue. Maybe open an issue there? |
I went ahead and reported this against the Rust compiler builtins library, but I think they are probably going to say it is out of scope for them. If you look at https://github.com/rust-lang/compiler-builtins#unimplemented-functions it lists |
They also suggest a way to get a Rust project to use the C compiler's versions of the intrinsics, but it seems to be impossible to do on any stable release of the Rust compiler ever, which presumably means people can't genuinely use it? rust-lang/compiler-builtins#562 |
In the short term you might also want to just go with the |
I think that is the workaround I'm going to have to take for now. But I'm worried that whatever the next problem is to come out of using the "wrong" intrinsics won't be so easy to bypass. |
I agree it seems wrong that rust doesn't include these functions in its compiler-rt in this case. However I does seem like a rust toolchain issue, not a wasi-sdk one, so perhaps we could close this in favor of an issue in a rust repo? |
CC @alexcrichton who knows rust stuff |
Thanks for the cc, I can try to help out a bit here! Agreed with all of the diagnosis and commentary so far, so I'll offer some thoughts on where this symbol might live. As y'all have found the Rust version of compiler-builtins lives here and is a Historically the compiler-builtins crate was intended to be Rust-specific meaning that it contains intrinsics that LLVM might emit calls to for rustc-generated code. This means that historically support for Now that being said lots of time has passed in the interim since I worked on things here and so perspectives may have shifted and/or things changed in the meantime. In that sense I'd say that historically intrinsics like this were the responsibility of Rust crates using C, but nowadays it may be shifted elsewhere. I also think that the theory of using the system-provided compiler-rt is probably a disproportionately larger task than might otherwise be required implementing intrinsics like this. Given all that, I'd recommend one of two routes:
If using Rust stable is a requirement then I'd recommend updating the sqlite build script to pass |
So this would involve doing something to the Because I think the intrinsics don't get linked in until the very end; I don't think |
Regarding getting the name of libcompiler-rt you can use |
That would be a localized change to |
I'm trying to build
rusqlite
for Rust, usingwasi-sdk
20 as myCC_wasm32_wasi
environment variable value.This appears to work, but at runtime in
wasmtime
I can't load the resulting binaries, because__extenddftf2
is missing.I noticed that symbol name in
wasi-sdk-20.0/share/wasi-sysroot/share/wasm32-wasi/undefined-symbols.txt
. Isn't it supposed to be defined by the SDK, if the compiler doesn't throw an error when code tries to use it?Is this builtin somehow out of scope for the SDK? Am I supposed to be using another library to provide it? Do I need to somehow convince
rusqlite
or SQLite itself that it isn't actually available for its C code?The text was updated successfully, but these errors were encountered: