wasi-sdk icon indicating copy to clipboard operation
wasi-sdk copied to clipboard

Publish header with toolchain versions

Open abrown opened this issue 1 year ago • 6 comments

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:

// 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.

abrown avatar Sep 05 '24 18:09 abrown

Thanks very much for looking into this! This would solve our problem very neatly!

To be clear, would I want to include <version.h> or would it be located elsewhere?

grynspan avatar Sep 05 '24 18:09 grynspan

Thanks very much for looking into this! This would solve our problem very neatly!

To be clear, would I want to include <version.h> or would it be located elsewhere?

I think you would include <wasi/version.h>. We certainly wouldn't want to call the file version.h if it was in the default include path, as that would be asking for trouble.

sbc100 avatar Sep 05 '24 18:09 sbc100

To be clear, would I want to include <version.h> or would it be located elsewhere?

@grynspan, I think it would be <wasi/version.h>?

abrown avatar Sep 05 '24 18:09 abrown

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)

yes. i'm against this because it introduces an incompatibility between wasi-sdk and direct use of wasi-libc. (programs including this header won't build for the latter)

yamt avatar Sep 05 '24 23:09 yamt

If we did this exclusively in wasi-libc it could look like: https://github.com/WebAssembly/wasi-libc/pull/534.

abrown avatar Sep 12 '24 22:09 abrown

Could the two be combined? Such that -libc provides its version and -sdk provides its version?

grynspan avatar Sep 12 '24 22:09 grynspan

I'm not really working on this any more.

abrown avatar Jun 02 '25 21:06 abrown