-
Notifications
You must be signed in to change notification settings - Fork 77
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
dist
seems to ignore environmnet variables configured in .cargo/config.toml
#1571
Comments
hello @jan-ferdinand ! thank you so much for the detailed issue and repro, it's super appreciated. offhand, this feels like a bug to me as i know we have code to handle RUSTFLAGS (https://github.com/axodotdev/cargo-dist/blob/main/cargo-dist/src/build/cargo.rs#L73). i agree that editing the you may be able to use the out of curiousity- is the project you are building part of a workspace? by default, we run |
Thanks for your speedy reply & help!
The
Thanks for the pointer. I will play around and see if I can get something going.
The project where I stumbled across this is a workspace, yes. The minimal failing example repository is not. This seems to suggest that workspaces have nothing to do with it, but this is not a very educated guess. Of course, different bugs could cause seemingly identical behavior. |
I have managed to work around the concrete issue using a custom build step feature, as thankfully suggested by @ashleygwilliams. Should somebody else stumble across this issue between now and a fix for the underlying bug, here are some gottchas I ran into:1
# this works
run: echo RUSTFLAGS="$RUSTFLAGS --cfg tokio_unstable" >> "$GITHUB_ENV"
# this does not work
run: echo "RUSTFLAGS=\"$RUSTFLAGS --cfg tokio_unstable\"" >> "$GITHUB_ENV" The version that doesn't work is closer to the documented way of setting an environment variable in a github workflow. Footnotes
|
Hey @jan-ferdinand ! First off, really glad the custom build step worked for you. I very much appreciate the detailed experiment report as well. If you are interested in making a PR to fix the docs, let me know, otherwise I'll make sure that gets handled. I think if you were interested in adding any of the caveats you've mentioned here to the docs, that would be great as well. You are right about the comment noting the difficulty of RUSTFLAGS- I'll take a look at the crate you mentioned and see if we can get you off the custom build step soon. If you are interested in taking it on I would be happy to help you through it! |
The binary distribution tool we use, `dist`, seems to ignore `RUSTFLAGS` set in `.cargo/config.toml`. See also: axodotdev/cargo-dist#1571 Using a custom build setup, it is possible to patch `RUSTFLAGS`. This is considered a temporary patch, until the underlying bug in `dist` is fixed. See also: https://opensource.axo.dev/cargo-dist/book/ci/customizing.html changelog: ignore
tl;dr: minimally failing example
Description
In a project I'm working on, we're using
tokio
's unstable features. Those features require opt-in through an environmnent variable. This environment variable can be set in the file.cargo/config.toml
, which is what we do. Unfortunately,dist build
seems to ignore this configuration. As a result, the compilation step duringdist build
fails.What I've tried
RUSTFLAGS="--cfg tokio_unstable" dist build
1 works fine.dist
book.Questions
dist
?release.yml
to jam this environment variable in there every time I rundist init
.Footnotes
as you might expect,
RUSTFLAGS="--cfg tokio_unstable"
is the environment variable configured in.cargo/config.toml
↩The text was updated successfully, but these errors were encountered: