Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
CARGO_CFG_TARGET_ENV
to determine if the _target_ env ABI is `g…
…nu` (#31) The unfortunately named `target_cfg` used in a `cfg()` macro / attribute is a *host* flag (as all other `cfg()`s) when a build script _using this library_ is compiled for the host. Instead, the `ENV` of the compile _target_ should be read from an environment variable (just like `$TARGET`) when this code is being run _on the host_ to figure out what the target environment ABI is. This causes a cross-compile via `xwin` (reported in #30) to invoke the `glibc` compile test even though windows doesn't provide `glibc`. When cross-compiling to `x86_64-pc-windows-msvc` `target_env` will still be `"gnu"` while `CARGO_CFG_TARGET_ENV` properly represents `msvc`. Aside from this I do think that the compile-check is valid for MSVC, the warning in that error even suggests to include `<string.h>`, but the test `.c` file already does exactly this... Perhaps the arguments set up by `xwin` and/or the `sccache` wrapper there are incompatible with how we invoke the compiler for this test?
- Loading branch information