-
Notifications
You must be signed in to change notification settings - Fork 507
flag_check.exe
being generated in source tree
#1411
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
Comments
An even smaller repro:
fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
dbg!(cc::Build::new().is_flag_supported("-Ccontrol-flow-guard")?);
Ok(())
} |
I think the bug might be triggered by Line 314 in 181c03d
|
Do you mean that it appears outside Or is that it generates a binary within |
It appears outside target, in the same folder as the crates cargo.toml |
I recall seeing something like this before. I believe that was caused by not setting the output directory when invoking the C compiler. So it would use the current directory which, if cc is in a build script, will be the project's root. |
This line introduced in #1336 (@ChrisDenton's pr) seems to be when the bug started manifesting. commenting out that line on main seems to cause the bug to no longer manifest. Looks like its because before the addition of that line,
and it would erroneously report the flag as not supported (which is what #1336 fixed)
Agree with this. I was wondering why this wasn't already the case, but seems like before #1336, it just never got to the point of compiling successfully ever |
Okay, I think setting |
Oh, I just realised we do already set |
Ok I've submitted my patch(#1415 ) using I also added a quick "is the git working tree clean" check for any CI jobs that produce artifacts so to prevent any more future regressions of this bug |
Great! Thanks for both reporting and fixing this. |
Under certain circumstances, a
flag_check.exe
appears in the root of crates usingcc
in their build scripts. This appears to be a regression of an issue that was fixed by #246. I've confirmed this issue is present in all versions starting from1.2.7
to at least1.2.15
, so it seems like something in1.2.7
is causing this regression.In order to trigger this issue, I needed to have the following in my
.cargo/config.toml
:Given the diff of 1.2.7 and the fact I need to provide
-Ccontrol-flow-guard
to get this to trigger, I'm guessing something is causingis_flag_supported_inner
to run, and that that is erroneously dropping the linked artifact in root of the crateA minimal repro is available at https://github.com/wmmc88/minimal-repros/tree/cc-flag-check
The text was updated successfully, but these errors were encountered: