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

Bump flake and fix wasm builds; CI improvements #108

Merged
merged 10 commits into from
Apr 23, 2024
Merged

Bump flake and fix wasm builds; CI improvements #108

merged 10 commits into from
Apr 23, 2024

Conversation

steveej
Copy link
Member

@steveej steveej commented Apr 22, 2024

please see commit messages for details

@steveej steveej requested a review from jost-s April 22, 2024 08:31
@steveej steveej changed the title Bump flake Bump flake and fix wasm builds Apr 22, 2024
with a recent rust update (to 1.75.0) this breaks wasm builds as they
wrongly inherit the flags defined in
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS. as it's unclear to me
why that is, i opted to clear the entire environment which also disables
inheritance, and add only the desired necessary variables back
@steveej steveej changed the title Bump flake and fix wasm builds Bump flake and fix wasm builds; CI improvements Apr 22, 2024
@jost-s
Copy link
Contributor

jost-s commented Apr 22, 2024

@steveej It looks fine to me but the tests are failing.

@steveej
Copy link
Member Author

steveej commented Apr 22, 2024

@steveej It looks fine to me but the tests are failing.

yes it's not fine yet. the workaround clears the env of something that's apparently needed. i couldn't figure out yet what needs to be removed from the env and stop inheritance for the Command. that'd be preferable IMO

Copy link
Member Author

@steveej steveej left a comment

Choose a reason for hiding this comment

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

cleanup

test/build.rs Outdated Show resolved Hide resolved
test/build.rs Outdated Show resolved Hide resolved
@steveej
Copy link
Member Author

steveej commented Apr 23, 2024

@jost-s i figured out the env var that needs to be cleared. if you approve i'll clean up the commit history before merging.

@steveej steveej requested review from jost-s and removed request for jost-s April 23, 2024 15:50
@jost-s
Copy link
Contributor

jost-s commented Apr 23, 2024

@steveej Wait, this seems like a problem with the rustDev shell. Instead of working around it here, should it not be removed there?

@jost-s
Copy link
Contributor

jost-s commented Apr 23, 2024

I'll merge this as a workaround to unblock the release.

@jost-s jost-s merged commit 1ec2ba6 into develop Apr 23, 2024
5 checks passed
@jost-s jost-s deleted the bump_flake branch April 23, 2024 16:55
@steveej
Copy link
Member Author

steveej commented Apr 24, 2024

@jost-s

@steveej Wait, this seems like a problem with the rustDev shell. Instead of working around it here, should it not be removed there?

the inner cargo build --target wasm32-unknown-unknown spawned from the build.rs runs in the context of the outer cargo build [--target x86_64-linux-unknown-gnu] (i augmented the target architecture spec which is implied by the ubuntu-latest CI runner).

for that target, the rustDev shell sets these flags: export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="$CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS -Clink-arg=-fuse-ld=mold".

the effect of it is the environment variable that i removed from the inner job in this PR, because we don't intend that effect for the wasm target.

let me know if that explains it for you.

@jost-s
Copy link
Contributor

jost-s commented Apr 24, 2024

@steveej In effect does that mean that mold cannot link wasm targets? And why is that outer env var's target x86_64 even applied for wasm32?

@steveej
Copy link
Member Author

steveej commented Apr 24, 2024

In effect does that mean that mold cannot link wasm targets?

true.

And why is that outer env var's target x86_64 even applied for wasm32?

because of this, specifically the bold part

the inner cargo build --target wasm32-unknown-unknown spawned from the build.rs runs in the context of the outer cargo build [--target x86_64-linux-unknown-gnu] (i augmented the target architecture spec which is implied by the ubuntu-latest CI runner).

within that context, the environment variable CARGO_ENCODED_RUSTFLAGS=-Clink-arg=-fuse-ld=mold is set. spawning another cargo build inherits it from its parent process. hence this PR specifically removes this variable from the spawned process.

@jost-s
Copy link
Contributor

jost-s commented Apr 24, 2024

@steveej But the target platforms are different, it's x86_64 in one and wasm32 in the other. Why a specific target triple if it's applied in a general way? Is the x86_64 applied anyway despite the difference in platform?

@steveej
Copy link
Member Author

steveej commented Apr 24, 2024

@jost-s

  1. nix develop spawns a shell that will have CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS -Clink-arg=-fuse-ld=mold" set
  2. cargo build [--target x86_64-linux-unknown-gnu] discovers CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=... in its environment and translates this to CARGO_ENCODED_RUSTFLAGS=... for itself and its spawned children.
  3. while processing the test/build.rs, cargo build --target wasm32-unknown-unknown is spawned, which discovers CARGO_ENCODED_RUSTFLAGS=... in its environment and thus uses mold accordingly.

does that help?

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

2 participants