Skip to content

dioxus-cli: 0.6.0 -> 0.6.2#375874

Merged
pbsds merged 1 commit intoNixOS:masterfrom
CathalMullan:dioxus-cli-v0.6.2
Feb 14, 2025
Merged

dioxus-cli: 0.6.0 -> 0.6.2#375874
pbsds merged 1 commit intoNixOS:masterfrom
CathalMullan:dioxus-cli-v0.6.2

Conversation

@CathalMullan
Copy link
Member

@CathalMullan CathalMullan commented Jan 22, 2025

  • enabled 'no-downloads' feature
  • patched wasm-opt-sys to fix build on Darwin (and possibly other?) hosts. See the check here which was failing.
  • patched dioxus-cli to fix wasm-opt target directory.
  • skipped wasm-bindgen tests which try to download from GitHub

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@CathalMullan CathalMullan mentioned this pull request Jan 22, 2025
13 tasks
@brianmay
Copy link
Contributor

After upgrading my flake to 0.6.2 from this PR, I can no longer build the flake:

  48.413s ERROR err=Other(Failed to write main executable

Caused by:
    0: I/O Error: No such file or directory (os error 2)
    1: No such file or directory (os error 2)) 
  48.414s ERROR err=Other(Failed to write main executable

Caused by:
    0: I/O Error: No such file or directory (os error 2)
    1: No such file or directory (os error 2)) 

Wonder if I am doing something stupid. But unfortunately those messages are remarkably unhelpful.

Will continue to investigate.

@ToyVo
Copy link
Contributor

ToyVo commented Jan 27, 2025

After upgrading my flake to 0.6.2 from this PR, I can no longer build the flake:

  48.413s ERROR err=Other(Failed to write main executable

Caused by:
    0: I/O Error: No such file or directory (os error 2)
    1: No such file or directory (os error 2)) 
  48.414s ERROR err=Other(Failed to write main executable

Caused by:
    0: I/O Error: No such file or directory (os error 2)
    1: No such file or directory (os error 2)) 

Wonder if I am doing something stupid. But unfortunately those messages are remarkably unhelpful.

Will continue to investigate.

Same, wasm-opt is from binaryen but even when its in my $PATH in the buildphase I get this error

  99.439s  INFO Compiling [210/229]: dioxus_fullstack
  99.472s  INFO Compiling [211/229]: dioxus_web
  99.484s  INFO Compiling [212/229]: dioxus
 100.404s  INFO Bundling app...
 100.405s  INFO Running wasm-bindgen...
 100.466s  INFO Running optimization with wasm-opt... 
 100.467s ERROR err=Other(Failed to write main executable

Caused by:
    0: I/O Error: No such file or directory (os error 2)
    1: No such file or directory (os error 2)) 
 100.467s ERROR err=Other(Failed to write main executable

@brianmay
Copy link
Contributor

brianmay commented Jan 27, 2025

strace shows is was writing to:

/build/2ghcn16mf9hn8rbi1hdhscg9ivwih7bq-source/target/dx/penguin_nurse/release/web/public/wasm-bindgen/penguin_nurse_bg.wasm

But then it tries reading from:

/build/2ghcn16mf9hn8rbi1hdhscg9ivwih7bq-source/target/dx/penguin_nurse/release/web/public/wasm/penguin_nurse_bg.wasm

Which of course doesn't exist.

Some how this is only a problem when building with "--release", and occurs when building outside a flake also.

i.e.

rm -rf target
dx build --platform web
dx build --platform web --release

The first build command works, the second fails.

@ToyVo
Copy link
Contributor

ToyVo commented Jan 27, 2025

https://github.com/DioxusLabs/dioxus/blob/c85018300b5ee4df3f715ec9507421b3892317a5/packages/cli/src/build/bundle.rs#L712
I don't remember if I've built outside of a flake, I should try and verify

This function returns early on non release

@CathalMullan
Copy link
Member Author

Doesn't appear to be a Nix specific issue.

I can recreate the issue by building one of the examples in the Dioxus repo.

cargo run --package dioxus-cli --features no-downloads,optimizations -- build --example hello_world --platform web --release  

Changing this line seems to fix the issue.

// Only run wasm-opt if the feature is enabled
// Wasm-opt has an expensive build script that makes it annoying to keep enabled for iterative dev
// We put it behind the "wasm-opt" feature flag so that it can be disabled when iterating on the cli
- self.run_wasm_opt(&self.build.exe_dir())?;
+ self.run_wasm_opt(&self.build.wasm_bindgen_out_dir())?;
   1.446s  INFO Running optimization with wasm-opt...
   8.776s  INFO Copying asset (0/2): /home/cmullan/workspace/dioxus/target/dx/hello_world/release/web/public/wasm-bindgen/hello_world.js
   8.776s  INFO Copying asset (1/2): /home/cmullan/workspace/dioxus/target/dx/hello_world/release/web/public/wasm-bindgen/hello_world_bg.wasm
  14.343s  INFO Build completed successfully! 🚀 path="/home/cmullan/workspace/dioxus/target/dx/hello_world/release/web/public"

@ToyVo
Copy link
Contributor

ToyVo commented Jan 27, 2025

Doesn't appear to be a Nix specific issue.

My testing agrees

When using dx from cargo (without optimization feature) I have a successful build which is unsurprising.

When using dx from this PR (with optimization feature) and in a nix develop shell, I get the failure from using the same dx to build within a flake

When reinstalling dx from cargo with optimizations flag enabled I get the same error

@ToyVo
Copy link
Contributor

ToyVo commented Jan 27, 2025

I've created an issue upstream DioxusLabs/dioxus#3659

@CathalMullan
Copy link
Member Author

Same, wasm-opt is from binaryen but even when its in my $PATH in the buildphase I get this error

Just to clarify, you don't need binaryen in your $PATH, it's bundled as a library via wasm-opt-rs.

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 28, 2025
@nix-owners nix-owners bot requested a review from xanderio January 28, 2025 13:55
Copy link
Contributor

@brianmay brianmay left a comment

Choose a reason for hiding this comment

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

Works fine for me now.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 1, 2025
@CathalMullan
Copy link
Member Author

Pushed an update to resolve the conflict caused by #376038

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 7, 2025
@pbsds pbsds merged commit 8bcdb5c into NixOS:master Feb 14, 2025
27 checks passed
@CathalMullan CathalMullan deleted the dioxus-cli-v0.6.2 branch February 16, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants