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

wasm-builder: manually set CARGO_TARGET_DIR #1951

Merged
merged 2 commits into from
Oct 23, 2023
Merged

Conversation

aj3n
Copy link
Contributor

@aj3n aj3n commented Oct 20, 2023

βœ„ -----------------------------------------------------------------------------

Thank you for your Pull Request! πŸ™ Please make sure it follows the contribution guidelines outlined in
this document and fill
out the sections below. Once you're ready to submit your PR for review, please
delete this section and leave only the text under the "Description" heading.

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context,
including:

  • What does this PR do?

make 'substrate-wasm-builder' manually set 'CARGO_TARGET_DIR' to '$project_dir/target' while building instead of unset 'CARGO_TARGET_DIR';

  • Why are these changes needed?

If you using this in the build.rs with following content in your `~/.cargo/config.toml':

[build]
target-dir = "target"

the build process will stuck because of dead lock -- two cargo build on same target directory in the same time.
There is already an attempt to avoid such dead lock by unset the CARGO_TARGET_DIR, but for users with config above in his build enviroment (like me), this workaround won't work.

  • How were these changes implemented and what do they affect?

Instead of unset 'CARGO_TARGET_DIR', we set 'CARGO_TARGET_DIR' to '$project/target/', which is already assumed to be true by rest of the code.

Use Github semantic
linking

to address any open issues this PR relates to or closes.

Fixes # (issue number, if applicable)

Closes # (issue number, if applicable)

Checklist

  • My PR includes a detailed description as outlined in the "Description" section above
  • My PR follows the labeling requirements of this project (at minimum one label for T
    required)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

You can remove the "Checklist" section once all have been checked. Thank you for your contribution!

βœ„ -----------------------------------------------------------------------------

I have built my project with this fix, there's still some warnings with build.target-dir set but the building process won't hang.
I haven't found related issue in this repo. But I did find one issue here.

@cla-bot-2021
Copy link

cla-bot-2021 bot commented Oct 20, 2023

User @aj3n, please sign the CLA here.

@bkchr
Copy link
Member

bkchr commented Oct 21, 2023

@aj3n what are you waiting for?

@aj3n aj3n marked this pull request as ready for review October 23, 2023 01:52
@aj3n aj3n requested a review from koute as a code owner October 23, 2023 01:52
@aj3n
Copy link
Contributor Author

aj3n commented Oct 23, 2023

Anyone add a label to this pr? It seems I don't have the permission to do that;

@bkchr bkchr added the R0-silent Changes should not be mentioned in any release notes label Oct 23, 2023
@bkchr bkchr merged commit 38c3c62 into paritytech:master Oct 23, 2023
119 of 121 checks passed
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
βœ„
-----------------------------------------------------------------------------

Thank you for your Pull Request! πŸ™ Please make sure it follows the
contribution guidelines outlined in
[this
document](https://github.com/paritytech/polkadot-sdk/blob/master/docs/CONTRIBUTING.md)
and fill
out the sections below. Once you're ready to submit your PR for review,
please
delete this section and leave only the text under the "Description"
heading.

# Description

*Please include a summary of the changes and the related issue. Please
also include relevant motivation and context,
including:*

- What does this PR do?

make 'substrate-wasm-builder' manually set 'CARGO_TARGET_DIR' to
'$project_dir/target' while building instead of unset
'CARGO_TARGET_DIR';

- Why are these changes needed?

If you using this in the `build.rs` with following content in your
`~/.cargo/config.toml':

    [build]
    target-dir = "target"

the build process will stuck because of dead lock -- two `cargo build`
on same target directory in the same time.
There is already an attempt to avoid such dead lock by unset the
`CARGO_TARGET_DIR`, but for users with config above in his build
enviroment (like me), this workaround won't work.

- How were these changes implemented and what do they affect?

Instead of unset 'CARGO_TARGET_DIR', we set 'CARGO_TARGET_DIR' to
'$project/target/', which is already assumed to be true by rest of the
code.

*Use [Github semantic

linking](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
to address any open issues this PR relates to or closes.*

Fixes # (issue number, *if applicable*)

Closes # (issue number, *if applicable*)

# Checklist

- [x] My PR includes a detailed description as outlined in the
"Description" section above
- [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
of this project (at minimum one label for `T`
  required)
- [ ] I have made corresponding changes to the documentation (if
applicable)
- [ ] I have added tests that prove my fix is effective or that my
feature works (if applicable)

You can remove the "Checklist" section once all have been checked. Thank
you for your contribution!

βœ„
-----------------------------------------------------------------------------

I have built my project with this fix, there's still some warnings with
`build.target-dir` set but the building process won't hang.
I haven't found related issue in this repo. But I did find one issue
[here](https://github.com/substrate-developer-hub/substrate-node-template/issues/116).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants