-
Notifications
You must be signed in to change notification settings - Fork 200
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
Enhancement request: interface to get the wasi-libc version at runtime #490
Comments
How about this? Much like Emscripten does, we generate a |
That would work for my needs, yeah. I don't have any constraints on the format of the string, but having something here would allow us to better-triage bug reports when devs are using WASI. Are you saying the header is already available, or would need to be added? |
Thinking about this more: the |
i don't understand why such an api is necessary at all. |
@yamt That's a fair question. I work on a library that's a component of the Swift toolchain, and that library doesn't typically know what version of wasi-libc (or other parts of the WASI stack) it's linked against. We know we're building for WASI and for Wasm32/Wasm64, but do not have version information. When we get a bug report, we unfortunately can't always rely on the human-authored parts of the report being detailed enough for us to figure out what WASI bits are being used. We want to be able to include version information for the environment in the auto-generated portion of the bug report. I hope that clarifies things! |
@grynspan, thanks for the clarification. One more question: we added a |
I guess there is nothing POSIX/musl that works like https://man7.org/linux/man-pages/man3/gnu_get_libc_version.3.html? Perhaps we could fit it into the output of |
@abrown Yes, I think that value (specifically the line indicating The expectation is that when you run
Where So having an exported "version" symbol is ideal for us because we can basically just say "Hey, WASI, what version are you?" and then report it without needing to plumb it through layers of Swift that may or may not even exist. @sbc100 We actually use the C function |
If thats the case then is the thing you really want to know the the OS/host version, and not the libc version? i.e. does your existing code have any way to detect the libc version for glibc/bionic/musl at runtime? If you are after the name / version of the host environment I doubt that is something that WASI will add. |
Re-reading your reply it look like you are indeed wanting the OS version. In that case I don't think that version of wasi-libc is important/relevant here and WASI is unlikely to give you any kind of host version information, so I think just using whatever info the |
What I'm after is, ideally, I think, the version of wasi-sdk, but the version of wasi-libc will suffice for this diagnostic purpose because we ought to be able to tie it back to a specific WASI SDK release manually. I think I conflated the two when I filed this issue, which is my own fault for not knowing enough about WASI as I ought to. Sorry about that. I'm not terribly interested in information about the environment hosting WASI, as it shouldn't matter in theory (although if you did plumb it through too, I wouldn't object.)
Edit: To clarify "the version of the OS": in the context of SwiftWasm, WASI is the OS, not the host. |
I think it could make sense add the version of WASI we are using to the uname()? e.g. But I don't think the version of wasi-sdk/wasi-libc makes sense there TBH. I also don't think you should think of the wasi-sdk version as your OS version.. maybe the version of underlying WASI API being used is what you want? (e.g. wasip1 vs wasip2). |
I would have to defer to you here—if that's the appropriate string to expose, then we'll take it. |
@sbc100, the |
I'm not sure that is true. If we are looking for an analog of As I said, far more useful would be the name and version of the runtime.... but that seems unlikely. So the version of the WASI interface seems like the best compromise here. |
Sorry, I think I misread. Don't we already include What I'm not so sure about is adding a |
Yeah, I agree with your reticence to add the special function stuff. @grynspan, if we give you a version.h to include that has all the relevant things you need, will you be able to plumb that through to where you need it? |
At the risk of going off topic, I assume there is no appetite for providing something like |
You mean in WASI? |
iirc musl intentionally avoids having that kind of features. |
Correct—I had mistakenly conflated the libc version with the wasi-sdk version when filing this issue.
That would suite us perfectly fine, yeah. Honestly, any of the proposals in this issue would be sufficient for us. :) |
This change is an attempt to resolve [wasi-libc#490] but at the wasi-sdk level. It adds a `version.h` header file to `share/wasi-sysroot/include/<target>/wasi` so that users have programmatic access to some extra information to output better error messages, e.g. This `version.h` looks something like: ```c // Generated by wasi-sdk's `version.py` script. ``` It _is_ a bit strange that we're adding to wasi-libc's include files from wasi-sdk (it would be cleaner if it happened in wasi-libc directly) but wasi-sdk actually has the information available. [wasi-libc#490]: WebAssembly/wasi-libc#490
This change is an attempt to resolve [wasi-libc#490] but at the wasi-sdk level. It adds a `version.h` header file to `share/wasi-sysroot/include/<target>/wasi` so that users have programmatic access to some extra information to output better error messages, e.g. This `version.h` looks something like: ```c // Generated by wasi-sdk's `version.py` script. #ifndef VERSION_H #define VERSION_H #define WASI_SDK_VERSION "24.6g754aec3d6f58+m" #define WASI_LIBC_VERSION "b9ef79d7dbd4" #endif ``` It _is_ a bit strange that we're adding to wasi-libc's include files from wasi-sdk (it would be cleaner if it happened in wasi-libc directly) but wasi-sdk actually has the information available. [wasi-libc#490]: WebAssembly/wasi-libc#490
Let's see what everyone thinks of: WebAssembly/wasi-sdk#487. |
I work on a Swift testing library, swift-testing (https://github.com/apple/swift-testing). I'm looking at adding Wasm/WASI support using the SwiftWasm toolchain (https://www.swiftwasm.org/). One of the things we do when starting a test run is log some diagnostic info including the OS version so that developers can say "oh, this test always fails on Ubuntu 23 (or macOS 30 or Windows 12 etc.), I'd better fix that."
For WASI, I'm told that the platform has a concept of a "current version" and I see that wasi-libc internally knows its own version, but there's no interface to read it at runtime. So I'm hoping such an interface could be added. I don’t have a particular interface design in mind.
Thanks!
The text was updated successfully, but these errors were encountered: