Skip to content

Switch to Cargo's -Zbuild-std for building libstd #1796

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

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,11 @@ jobs:
steps:
- template: ci/azure-install-rust.yml
parameters:
toolchain: nightly-2019-08-27
toolchain: nightly-2019-09-26
# Temporarily disable sccache because it is failing on CI.
# - template: ci/azure-install-sccache.yml
- script: rustup component add rust-src
displayName: "install rust-src"
- script: cargo install xargo
displayName: "install xargo"
- script: |
set -e
sed -i 's/python/#python/' examples/raytrace-parallel/build.sh
Expand Down
2 changes: 0 additions & 2 deletions examples/raytrace-parallel/Xargo.toml

This file was deleted.

24 changes: 16 additions & 8 deletions examples/raytrace-parallel/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

set -ex

# Two critical steps are required here to get this working:
# A few steps are necessary to get this build working which makes it slightly
# nonstandard compared to most other builds.
#
# * First, the Rust standard library needs to be compiled. The default version
# is not compatible with atomics so we need to compile a version, with xargo,
# that is compatible.
# * First, the Rust standard library needs to be recompiled with atomics
# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
#
# * Next we need to compile everything with the `atomics` feature enabled,
# ensuring that LLVM will generate atomic instructions and such.
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' \
xargo build --target wasm32-unknown-unknown --release
# * Next we need to compile everything with the `atomics` and `bulk-memory`
# features enabled, ensuring that LLVM will generate atomic instructions,
# shared memory, passive segments, etc.
#
# * Finally, `-Zbuild-std` is still in development, and one of its downsides
# right now is rust-lang/wg-cargo-std-aware#47 where using `rust-lld` doesn't
# work by default, which the wasm target uses. To work around that we find it
# and put it in PATH

PATH=$PATH:$(dirname $(find $(rustc --print sysroot) -name 'rust-lld')) \
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' \
cargo build --target wasm32-unknown-unknown --release -Z build-std -Z timings=html

# Note the usage of `--no-modules` here which is used to create an output which
# is usable from Web Workers. We notably can't use `--target bundler` since
Expand Down