-
Notifications
You must be signed in to change notification settings - Fork 460
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
Rebuild if changed #765
Comments
build.rs is executed whenever any file from the It should be noted that none of this is actually cc-rs-specific, it's how cargo works in general. |
It sounds as though I should expect the C compiler to be invoked if any of the files in Two points then:
|
As already implied, the question is when does cargo execute the build.rs. That's all to it. The fact that build.rs invokes C compiler is immaterial to the said decision.
Ah! It ought to be one of the recent modifications that broke it. It does work if you specify the dependency as
It's by cargo's design, we have to accept it.
It sounds like you'd be better off using cmake-rs. Idea would be to have cargo detect a change and hand it off to cmake to identify what actually needs to be done. Replicating the make functionality in cc-rs would probably be deemed out of this project's scope... |
More specifically emission of |
Thanks for the clarification. As long as my C code is trivial, Yes, using 1.0.73 does fix the issue for me. Thanks! |
I’m on vacation now, but I’ll investigate what broke in 1.0.74 when I get back. Note that pinning a version like that will cause problems for your users down the line, since if another crate in the dependency graph depends on a later version of cc, cargo will error (it only duplicates versions if they would be semver incompatible). |
Noted - thanks for the warning. Happy holidays! |
Is there anything more on this? I just ran into it in my project and it's quite a surprise when c files don't recompile (especially since they sometimes do - if you have errors and compilation fails, it will re-run on a new I've tried adding |
If I add |
Maybe we could add a new function |
When using the
cc
crate...what is the proper way to set up
build.rs
and/orCargo.toml
so thatcargo
will automatically recompile and relink the C/C++ files if they are changed since the last compilation? Maybe even list the local header files so changing them will trigger recompilation/relink as well?Alternatively, what is the proper way to force
cargo
to recompile all the C/C++ files?Right now I can always remove the
target/{debug,release}
directories to force recompilation but it seems like a hack.The text was updated successfully, but these errors were encountered: