Skip to content
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

Add llvm-12 and rust-compat tags #836

Closed
wants to merge 3 commits into from

Conversation

RReverser
Copy link
Collaborator

These are human-readable tags for emscripten-core/emscripten#14394 (comment).

I went with rust-compat instead of rust because emsdk install rust might be confusing and suggest that it will install Rust itself too.

These are human-readable tags for emscripten-core/emscripten#14394 (comment).

I went with `rust-compat` instead of `rust` because `emsdk install rust` might be confusing and suggest that it will install Rust itself too.
@RReverser
Copy link
Collaborator Author

ValueError: invalid literal for int() with base 10: 'rust'

okayyy

@RReverser
Copy link
Collaborator Author

RReverser commented Jun 8, 2021

Right, I thought I'd just remove the Rust one for now, but llvm tag fails too:

ValueError: invalid literal for int() with base 10: 'llvm'

I guess we need to change the code to accept identifiers in this position rather than trying to parse them as versions? Or maybe I need to add those to a different file? @sbc100 @kripken @dschuff

@kripken
Copy link
Member

kripken commented Jun 8, 2021

Yes, I guess there is code somewhere that assumes those are integers, that needs to be generalized. Fixing that is one option here.

Another might be to include the version number, that is, emit something like x.y.z-rust-a.b.c, x.y.z-llvm-w. The x.y.z version would be the emscripten version. That does seem useful in a sense, as it's close to that emscripten version, just adjusted. But maybe that could be confusing, I'm not sure.

@kripken
Copy link
Member

kripken commented Jun 8, 2021

The fix is pretty simple to allow those, but we are missing some info:

diff --git a/emsdk.py b/emsdk.py
index 79ffc55..9356945 100644
--- a/emsdk.py
+++ b/emsdk.py
@@ -2232,7 +2232,13 @@ def get_release_hash(arg, releases_info):
 
 
 def version_key(ver):
-  return tuple(map(int, re.split('[._-]', ver)[:3]))
+  try:
+    return tuple(map(int, re.split('[._-]', ver)[:3]))
+  except:
+    # some tagged releases are not numbered (e.g., "foo" instead of "2.0.x"),
+    # and we have no version for them.
+    return ()
 
 
 # A sort function that is compatible with both Python 2 and Python 3 using a

Without the version number, we don't know if it's upstream or fastcomp. We could perhaps force these all to be "2.0.0+", but that might be an argument for going the other way and including the version number.

@RReverser
Copy link
Collaborator Author

That does seem useful in a sense, as it's close to that emscripten version, just adjusted. But maybe that could be confusing, I'm not sure.

I think that somewhat defeats the purpose, because now the person still needs to look through the list of tags to find the suitable version. I'd rather have a convenience alias that's easy to remember & reuse.

@@ -1,6 +1,8 @@
{
"latest": "2.0.23",
"releases": {
"llvm-12": "56b877afe7d1b651d6b9a2ba5d5df074876172ff",
"rust-compat": "56b877afe7d1b651d6b9a2ba5d5df074876172ff",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we no just use the numbered released closest to the version we want?

Say, for example, 2.0.6. If we want to be very precise we could add a new tag called, for example, 2.0.6-rust-compat, then have "latest-rust-compat" work just like the "latest" alias above.

I think having it called something like 2.0.6-rust-compat is nice because it places the release in the timeline.

Copy link
Collaborator Author

@RReverser RReverser Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here (until we automate it on either emsdk or rustup side) to have a tracked tag that works for latest stable Rust and that we can update over time. If we have version tags, it creates possibility of several tags with X.Y.Z-rust-compat which again puts burden on user to find the one that works with latest stable.

It might be relatively easy, but I still think we should make things as simple as

rustup toolchain add stable
rustup target add wasm32-unknown-emscripten
emsdk install rust-compat

where user never has to bother with looking up actual version numbers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree. I was thinking internally though rust-compat could be an alias for X.Y.Z-rust-compat which itself then maps to a release SHA. See #837 for adding better alias system.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new alias system should make this much easier, nice!

I think my worries about x.y.z-rust etc. possibly being confusing are resolved by that. That is, the user would never need to see the x.y.z, as the alias takes care of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustup toolchain add stable
rustup target add wasm32-unknown-emscripten
emsdk install rust-compat

I think we need a version on the last line, though? The emsdk doesn't know that stable rust was installed. Or are you thinking that we would always assume stable in rust-compat, and maybe add other aliases for nightly etc.?

If so, then we would need to update rust-compat every time stable rust changes - how often is that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or are you thinking that we would always assume stable in rust-compat

Yeah that's what we talked about in the meeting and agreed upon I thought. The expectation is that most users are on latest stable Rust.

update rust-compat every time stable rust changes - how often is that?

Rather, every time they roll new LLVM, which IIRC @tlively said every 6 months.

@RReverser
Copy link
Collaborator Author

I'll leave this PR open, but sounds like we should wait for emscripten-core/emscripten#14394 (comment) (@kripken's comment) to resolve first.

@sbc100
Copy link
Collaborator

sbc100 commented Jun 19, 2021

We should revisit this now that we have support for multiple "aliases".

@RReverser
Copy link
Collaborator Author

The comment above still stands. Looks like we'll need to branch off 2.0.13 and backport or implement fixes for both issues listed in https://github.com/RReverser/emscripten-rust-test, and then use the resulting branch for these tags in emsdk.

1 similar comment
@RReverser
Copy link
Collaborator Author

The comment above still stands. Looks like we'll need to branch off 2.0.13 and backport or implement fixes for both issues listed in https://github.com/RReverser/emscripten-rust-test, and then use the resulting branch for these tags in emsdk.

@sbc100
Copy link
Collaborator

sbc100 commented Jun 19, 2021

Sadly we don't have any mechanism for backports or building binaries from anything but the main branch.

If there is no suitable version of the SDK from the past and we do really require a branched/patched SDK we would need to invest in some new tools.

@RReverser
Copy link
Collaborator Author

Sadly we don't have any mechanism for backports or building binaries from anything but the main branch.

If there is no suitable version of the SDK from the past and we do really require a branched/patched SDK we would need to invest in some new tools.

Oh, huh. I thought one-off build would be fairly easy.

@sbc100
Copy link
Collaborator

sbc100 commented Jun 20, 2021

Sadly we don't have any mechanism for backports or building binaries from anything but the main branch.
If there is no suitable version of the SDK from the past and we do really require a branched/patched SDK we would need to invest in some new tools.

Oh, huh. I thought one-off build would be fairly easy.

I mean we have a script that build the binaries.. its just getting it run on mac/linux and windows and having all the binaries uploaded. Not a huge feat, but we don't have any way to tell the bots to do it for us sadly.

@RReverser
Copy link
Collaborator Author

I mean we have a script that build the binaries.. its just getting it run on mac/linux and windows and having all the binaries uploaded. Not a huge feat, but we don't have any way to tell the bots to do it for us sadly.

Hmm, my understanding is that the fixes only need to be done on the Python side, so we probably could just reuse the binaries. But yeah I have no idea how uploading works.

@kripken
Copy link
Member

kripken commented Jun 21, 2021

I think that @RReverser 's point is right, that if the only patches needed are to emscripten, we can use the existing binaries. That is, we could add an option for the emsdk to download LLVM and Binaryen binaries for one releases hash, and use an arbitrary emscripten version with them. The emscripten version would be an arbitrary commit in emscripten, which in practice would be branched off from the releases hash for the binaries. We could test that on emscripten using those binaries (basically just tell CI to use them instead of tot).

So I think we would not need any bot changes to do this. Just an emsdk option - if it doesn't have one already? - to install emscripten from a specific emscripten (not releases) commit.

@sbc100
Copy link
Collaborator

sbc100 commented Jun 21, 2021

This would all be much easier if we hadn't fused all the tools into one big download. In the past llvm and binaryen and emscripten could all be pinned independently.

These days there is no tarball that contains llvm but not also emscripten itself :( I mean we can hack it so that we ignore that copy.. but its a bit sad.

@RReverser
Copy link
Collaborator Author

We probably want to add those tags at some point but the ones I used in this PR are pretty outdated by now.

@RReverser RReverser closed this Dec 7, 2023
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 this pull request may close these issues.

None yet

3 participants