Skip to content

uname inaccurately reports Emscripten version #16977

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

Closed
hoodmane opened this issue May 19, 2022 · 3 comments · Fixed by #17026
Closed

uname inaccurately reports Emscripten version #16977

hoodmane opened this issue May 19, 2022 · 3 comments · Fixed by #17026

Comments

@hoodmane
Copy link
Collaborator

It would be useful if uname reported the version of Emscripten:

strcpy(utsname->version, "#1");

@hoodmane
Copy link
Collaborator Author

Or if #15917 is resolved, then utsname->release could be updated whenever there is an ABI break.

hoodmane added a commit to hoodmane/pyodide that referenced this issue May 21, 2022
We use `packaging.tags.sys_tags` to get the list of supported tags
then use `packaging.utils.parse_wheel_filename` to get the set of
tags the current wheel implement then check if one of the wheel's
tags is a supported tag. This is a fully accurate check method and
could also catch things like abi3 wheels that are compatible with
multiple Python versions.

This allows micropip to be used to install binary emscripten wheels.
In order to manage the ABI issues, I also changed the wheel platform
tag to `emscripten_2_0_27_wasm32` so we can tell which version of
emscripten the wheel was built with.

The normal way that the platform tag is generated is by substituting
in the `uname` OS name and version info. Emscripten has dummy
information in `uname` instead of any actual version, so I patched
`uname` to report the Emscripten version. See upstream issue:
emscripten-core/emscripten#16977
@sbc100
Copy link
Collaborator

sbc100 commented May 23, 2022

I agree it might be nice to do this, but can you explain how it would be useful to you?

With emscripten you have to recompile your app on each upgrade so that compile time version found in emscripten/version.h will always match anyway.. so there is no need to call uname to find out of the version. Unlike with a normal UNIX there is no way to take a pre-compiled program and run it on a different version of emscripten.. since the "kernel" and the program are essentially embedded together into a single object by the linker.

@hoodmane
Copy link
Collaborator Author

Yeah, Python's sysconfig.get_platform() looks at uname:
https://github.com/python/cpython/blob/6a6f823ea7f565722148462a0372aa90085637bc/Lib/sysconfig.py#L756
this propagates into various runtime behaviors that try to detect ABI compatibility based on ABI tags in file names e.g., here:
https://github.com/pypa/packaging/blob/e8a06183c1958dfc45be802b6192619497638842/packaging/tags.py#L431

sbc100 added a commit that referenced this issue May 23, 2022
sbc100 added a commit that referenced this issue May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants