Skip to content
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

Use CARGO_CFG_TARGET_ENV to determine if the target env ABI is gnu #31

Commits on Sep 15, 2023

  1. Use CARGO_CFG_TARGET_ENV to determine if the _target_ env ABI is gnu

    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 jean-airoldie#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?
    MarijnS95 committed Sep 15, 2023
    Configuration menu
    Copy the full SHA
    1c4d412 View commit details
    Browse the repository at this point in the history