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

[BUG DEMO] invocation of cargo in workspace within build.rs causes hang in release #6563

Closed
wants to merge 1 commit into from

Conversation

vitiral
Copy link

@vitiral vitiral commented Jan 18, 2019

I migrated my application to use a workspace because I have several repositories which depend on eachother. Unfortunately, this has lead to me hitting a bug where cargo hangs when attempting to compile the wasm frontend.

I have created a demo here to demonstrate the issue. the below state happens indefinitely, and does not happen in debug mode.

Suggested fix: use different file locks for different targets. Compiling x86_64-unknown-linux-gnu shouldn't block wasm32-unknown-unknown

$ cd ./demo
$ cargo build -p project_main
   Compiling project_main v0.1.0 (/home/rett/open/cargo/demo/project_main)
    Finished dev [unoptimized + debuginfo] target(s) in 0.57s
                                                                                                   
$ cargo build -p project_main --release -vvv
   Compiling project_main v0.1.0 (/home/rett/open/cargo/demo/project_main)
     Running `/home/rett/open/cargo/demo/target/release/build/project_main-f4448f50b4263e12/build-script-build`
[project_main 0.1.0] building via cargo-web
[project_main 0.1.0]     Blocking waiting for file lock on build directory
    Building [==================>                                        ] 1/3: project_main(build)

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dwijnand (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@vitiral
Copy link
Author

vitiral commented Jan 18, 2019

It looks like I am hitting something like #6412. However, with wasm frontends (probably) going to become more common this is no longer a "feature request for a really awkward use case." People will want to bundle their frontend (but use libraries that are related) and include_bytes! it, and they will want to do it all from their build.rs file.

Obviously a solution is to NOT use build.rs to build the application, but I don't think we want that :D

@vitiral
Copy link
Author

vitiral commented Jan 18, 2019

Also, I can't simply remove project_frontend from the workspace because then I get this error:

$ cargo build
error: current package believes it's in a workspace when it's not:
current:   /home/rett/open/cargo/demo/project_wasm/Cargo.toml
workspace: /home/rett/open/cargo/demo/Cargo.toml

this may be fixable by adding `project_wasm` to the `workspace.members` array of the manifest located at: /home/rett/open/cargo/demo/Cargo.toml

@dwijnand
Copy link
Member

Interesting!

Thanks for also linking the demo here in #6412.

@dwijnand dwijnand closed this Jan 18, 2019
@vitiral vitiral mentioned this pull request Jan 18, 2019
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.

3 participants