-
Notifications
You must be signed in to change notification settings - Fork 8
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
Insert -Zbuild-std when building rust packages #40
base: main
Are you sure you want to change the base?
Conversation
Otherwise we are linking a copy of the standard library built with some particular version of emscripten selected by the rust compiler that does not match the version we are using. This can lead to an ABI mismatch. See rust-lang/rust#131467
e6928ea
to
a84379d
Compare
This tests the fix for rust-lang/rust#131467 in pyodide/pyodide-build#40. The problem is that rust cannot correctly read file metadata because the ABI of fstat64 changed between the version of emscripten that the rust compiler built the standard library against and our version of the rust compiler. By passing `-Zbuild-std` we rebuild the rust standard library with the correct abi. I also added a test that works only if we pass `-Zbuild-std`.
@juntyr says:
This would have the advantage of not requiring nightly for this feature, but it has the disadvantage that none of the tooling looks very maintained... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Well this is very tricky problem.
elif cmd == "cargo": | ||
line.insert(1, "-Zbuild-std") | ||
return line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test for this (test_pywasmcross.py)
5becdcf
to
6377f67
Compare
There is also https://github.com/RalfJung/rustc-build-sysroot which is maintained by a Rust project member but doesn't have a CLI; you'd need to wrap it. I think both those tools do still need a nightly compiler to generate the sysroot though. |
@davidhewitt Thanks for the info! Anyway, for now, we are having an issue that the |
I think for now we can bump to a rust nightly that contains rust-lang/rust#131533 and that will probably fix the trouble without |
Otherwise we are linking a copy of the standard library built with some particular version of emscripten selected by the rust compiler that does not match the version we are using. This can lead to ABI mismatch.
rust-lang/rust#131467
cc @messense @davidhewitt perhaps it would be good for maturin to also insert this flag when targeting emscripten.