RUST-2177 Fix WASM compilation failures #521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RUST-2177
Boy, it sure would be nice if the ecosystem around WASM would stabilize a bit.
There were
threefivesix things going on here:uuid
now requires thejs
feature when compiled on thewasm32.unknown.unknown
target (credit to Isabel for finding this one)getrandom
0.2.x and 0.3.x (fromahash
andrand
respectively); we had a conditional flag set in dev-dependencies for 0.2.x but we didn't have the equivalent (named a different thing -wasm_js
instead ofjs
) for 0.3.x.getrandom
0.3.x also requires thatcfg(getrandom_backend=wasm_js)
be enabled; normally the way to set customcfg
variables is by setting theRUSTFLAGS
env variable, but for the WASM test program actual compilation is controlled by thewasm-pack
wrapper scripts which fail to propagate that variable, so we have to set it in.cargo/config.toml
instead.getrandom
(both 0.2.x and 0.3.x) were moved from runtime to compile-time, so the feature additions are now in thebson
crate in the target-specificdependencies
section rather than being at the binary target/dev-dependency
level.node
installed on the test host was old enough to have broken behavior, and we were running on old enough hosts that they didn't have new enough glibc (!!) to install current node, so I updated to use newer hosts and installnode
locally for the tests.getrandom
0.3.x requires rust >= 1.80 for WASI support, so per our new policy I just bumped the crate MSRV from 1.71.1 up to 1.81 (the most recent version outside of the six month window).