cargo-c
cargo-c copied to clipboard
Choose the correct default target on MSYS2/MinGW64
I was hoping to get the right target automatically, since I'm using cargo
from MSYS2, which should know that it uses the GNU toolchain.
Strangely, when I'm using the MSYS2 package for cargo-c
(instead of compiling it on-the-fly), the --target
flag is not necessary (see https://github.com/mgeier/cargo-c/runs/4754623622)!
So why does the MSYS2 package of cargo-c
do the right thing?
Originally posted by @mgeier in https://github.com/lu-zero/cargo-c/pull/194#discussion_r780821730
it is not something cargo-c controls but defers to cargo (the crate).
Can you point me to the place where this information is obtained from cargo
?
Then I'll create a corresponding issue over there.
But the question remains: Why does the MSYS2 package of cargo-c
already do the right thing?
we look up what is in https://docs.rs/cargo/latest/cargo/util/config/struct.Config.html#method.load_global_rustc, I do not know how they are building cargo and how it is different from building the cargo crate as we build it.
FYI, you can follow all the MSYS2 patches and the build recipe here: https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-rust