Repository: rust-cross/cargo-zigbuild (language: python)

Issue:
bindgen support
- [x] Linux: added in #95 
- [x] macOS: added in https://github.com/rust-cross/cargo-zigbuild/pull/99
- [x] Windows gnu: added in https://github.com/rust-cross/cargo-zigbuild/pull/98


Discussion / hints:
Can you provide what's going wrong from your WIP branch? I need this feature, and I might be able to make a PR.
Try run it on `zstd-rs`

```bash
$ git clone --recurse-submodules https://github.com/gyscos/zstd-rs.git
$ cd cargo-zigbuild
$ cargo run zigbuild --manifest-path ../zstd-rs/Cargo.toml --features bindgen --target aarch64-unknown-linux-gnu
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/cargo-zigbuild zigbuild --manifest-path ../zstd-rs/Cargo.toml --features bindgen --target aarch64-unknown-linux-gnu`
   Compiling zstd-sys v2.0.7+zstd.1.5.4 (/Users/messense/Projects/zstd-rs/zstd-safe/zstd-sys)
error: failed to run custom build command for `zstd-sys v2.0.7+zstd.1.5.4 (/Users/messense/Projects/zstd-rs/zstd-safe/zstd-sys)`

Caused by:
  process didn't exit successfully: `/Users/messense/Projects/zstd-rs/target/debug/build/zstd-sys-5baf2753956d5f2f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG
  TARGET = Some("aarch64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
  CC_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
  CC_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-gcc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
  CFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
  CFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
  CC_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
  CC_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-gcc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
  CFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
  CFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
  CC_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
  CC_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-gcc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
  CFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
  CFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
  CC_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
  CC_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-gcc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
  CFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
  CFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/fse_decompress.o" "-c" "zstd/lib/common/fse_decompress.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/threading.o" "-c" "zstd/lib/common/threading.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/error_private.o" "-c" "zstd/lib/common/error_private.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/zstd_common.o" "-c" "zstd/lib/common/zstd_common.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/debug.o" "-c" "zstd/lib/common/debug.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/pool.o" "-c" "zstd/lib/common/pool.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/entropy_common.o" "-c" "zstd/lib/common/entropy_common.c"
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/fse_compress.o" "-c" "zstd/lib/compress/fse_compress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/hist.o" "-c" "zstd/lib/compress/hist.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/huf_compress.o" "-c" "zstd/lib/compress/huf_compress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress.o" "-c" "zstd/lib/compress/zstd_compress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_literals.o" "-c" "zstd/lib/compress/zstd_compress_literals.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_sequences.o" "-c" "zstd/lib/compress/zstd_compress_sequences.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_superblock.o" "-c" "zstd/lib/compress/zstd_compress_superblock.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_double_fast.o" "-c" "zstd/lib/compress/zstd_double_fast.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_fast.o" "-c" "zstd/lib/compress/zstd_fast.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_lazy.o" "-c" "zstd/lib/compress/zstd_lazy.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_ldm.o" "-c" "zstd/lib/compress/zstd_ldm.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_opt.o" "-c" "zstd/lib/compress/zstd_opt.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstdmt_compress.o" "-c" "zstd/lib/compress/zstdmt_compress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/huf_decompress.o" "-c" "zstd/lib/decompress/huf_decompress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_ddict.o" "-c" "zstd/lib/decompress/zstd_ddict.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_decompress.o" "-c" "zstd/lib/decompress/zstd_decompress.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_decompress_block.o" "-c" "zstd/lib/decompress/zstd_decompress_block.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/cover.o" "-c" "zstd/lib/dictBuilder/cover.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/divsufsort.o" "-c" "zstd/lib/dictBuilder/divsufsort.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/fastcover.o" "-c" "zstd/lib/dictBuilder/fastcover.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/zdict.o" "-c" "zstd/lib/dictBuilder/zdict.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v01.o" "-c" "zstd/lib/legacy/zstd_v01.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v02.o" "-c" "zstd/lib/legacy/zstd_v02.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v03.o" "-c" "zstd/lib/legacy/zstd_v03.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v04.o" "-c" "zstd/lib/legacy/zstd_v04.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v05.o" "-c" "zstd/lib/legacy/zstd_v05.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v06.o" "-c" "zstd/lib/legacy/zstd_v06.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v07.o" "-c" "zstd/lib/legacy/zstd_v07.c"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-ffunction-sections" "-fdata-sections" "-fmerge-all-constants" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/huf_decompress_amd64.o" "-c" "zstd/lib/decompress/huf_decompress_amd64.S"
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  cargo:rerun-if-env-changed=AR_aarch64-unknown-linux-gnu
  AR_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_aarch64_unknown_linux_gnu
  AR_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-ar")
  cargo:rerun-if-env-changed=ARFLAGS_aarch64-unknown-linux-gnu
  ARFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64_unknown_linux_gnu
  ARFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  running: ZERO_AR_DATE="1" "aarch64-unknown-linux-gnu-ar" "cq" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/libzstd.a" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/debug.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/entropy_common.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/error_private.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/fse_decompress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/pool.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/threading.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/common/zstd_common.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/fse_compress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/hist.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/huf_compress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_literals.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_sequences.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_compress_superblock.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_double_fast.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_fast.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_lazy.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_ldm.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstd_opt.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/compress/zstdmt_compress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/huf_decompress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_ddict.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_decompress.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/zstd_decompress_block.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/cover.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/divsufsort.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/fastcover.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/dictBuilder/zdict.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v01.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v02.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v03.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v04.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v05.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v06.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/legacy/zstd_v07.o" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/zstd/lib/decompress/huf_decompress_amd64.o"
  exit status: 0
  running: "aarch64-unknown-linux-gnu-ar" "s" "/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out/libzstd.a"
  exit status: 0
  cargo:rustc-link-lib=static=zstd
  cargo:rustc-link-search=native=/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out
  cargo:root=/Users/messense/Projects/zstd-rs/target/aarch64-unknown-linux-gnu/debug/build/zstd-sys-9af60aa221bd6c2e/out
  cargo:include=/Users/messense/Projects/zstd-rs/zstd-safe/zstd-sys/zstd/lib

  --- stderr
  /opt/homebrew/Cellar/zig/0.10.1/lib/zig/libc/include/generic-glibc/bits/local_lim.h:38:10: fatal error: 'linux/limits.h' file not found
  thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("/opt/homebrew/Cellar/zig/0.10.1/lib/zig/libc/include/generic-glibc/bits/local_lim.h:38:10: fatal error: 'linux/limits.h' file not found\n")', zstd-safe/zstd-sys/build.rs:30:40
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Indeed, with https://github.com/HyunggyuJang/cargo-zigbuild/commit/7ea724f2b661e13c1e2aeeaa21b0a5aa074e972d, it builds successfully, can you check it?

All we need to do is set sysroot properly, rather than including the header file directory, as the header file is linked from https://github.com/rust-cross/cargo-zigbuild/blob/d6e8cfcc3b5a2d24b078dc18123ab2802ec13da9/src/zig.rs#L364
Feel free to send a pull request, and we should add a integration test for it.
Hi, I am experiencing issues when using bindgen in a project and trying to build that with cargo-zigbuild. I have a hard time to pin down what is going wrong, but I have recreated a case that might give a clue. I suspect this is an issue with zigbuild, but I am not 100% sure.

The test project is basically a minimal test project that uses bindgen. Important detail here is that the header file that I am binding contains an include `#include <stdint.h>` which now needs to be available to bindgen.
I need to set `BINDGEN_EXTRA_CLANG_ARGS` to make sure bindgen finds the header files of glibc. I run this on an `x86_64-unknown-linux-gnu` machine and `cargo build` or `cargo build --target x86_64-unknown-linux-gnu` will run successfully.

Now when I use `cargo zigbuild`, this works fine, but this might be misleading. This command does does not appear to use zig and is basically equal to `cargo build`. Not sure if that is expected behavior.

Things get interesting when running `cargo zigbuild --target x86_64-unknown-linux-gnu`. Zig is clearly being invoked (visible when increasing verbosity) and the build fails: `Unable to generate bindings: ClangDiagnostic("hello/hello.h:1:10: fatal error: 'stdint.h' file not found\n")`. Setting `BINDGEN_EXTRA_CLANG_ARGS` and/or `BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu` does not make a difference. It seems these env variables are not passed correctly. When I change `build.rs` and use `bindgen::Builder::clang_arg()` to pass the glibc includes, then it works fine.

Let me know if you have any idea what is going on here!
Ok, it is cargo-zigbuild causing the problem. Basically it overwrites the `BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu` variable with a sysroot argument: https://github.com/rust-cross/cargo-zigbuild/blob/main/src/zig.rs#L457 . TBH, I don't really know why sysroot is set like this. At least one case (mine by coincidence) does not need this sysroot to be set.

Anyway, tomorrow I'll post a PR with some proposed changes to fix that. In that PR we can also discuss why this sysroot argument is there and if it should stay.

Fix patch:
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 96266ef..63111d5 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -33,6 +33,7 @@ jobs:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
         toolchain: [1.63.0, stable, nightly]
+        # Ideally we should also test against 0.9.0, but it is too unusable to test from CI
         zig: [0.10.1, master]
         exclude:
           # Only test MSRV with zig stable version
@@ -80,6 +81,9 @@ jobs:
           cargo run zigbuild --manifest-path tests/zstd-rs/Cargo.toml --features bindgen --target aarch64-unknown-linux-gnu
           cargo run zigbuild --manifest-path tests/zstd-rs/Cargo.toml --features bindgen --target x86_64-pc-windows-gnu
           cargo run zigbuild --manifest-path tests/zstd-rs/Cargo.toml --features bindgen --target aarch64-apple-darwin
+          cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target aarch64-unknown-linux-gnu
+          cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target x86_64-pc-windows-gnu
+          cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target aarch64-apple-darwin
       - name: macOS - Test build
         run: |
           cargo run zigbuild --target aarch64-apple-darwin
diff --git a/Cargo.lock b/Cargo.lock
index 1f201dc..d6d8704 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -57,6 +57,7 @@ dependencies = [
  "semver",
  "serde",
  "serde_json",
+ "shlex",
  "target-lexicon",
  "which",
 ]
@@ -453,6 +454,12 @@ dependencies = [
  "serde",
 ]
 
+[[package]]
+name = "shlex"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
+
 [[package]]
 name = "strsim"
 version = "0.10.0"
diff --git a/Cargo.toml b/Cargo.toml
index d7f0793..7908d32 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,7 @@ rustc_version = "0.4.0"
 semver = "1.0.5"
 serde = { version = "1.0.136", features = ["derive"] }
 serde_json = "1.0.79"
+shlex = "1"
 target-lexicon = { version = "0.12.5", features = ["std"] }
 which = "4.2.5"
 
diff --git a/src/zig.rs b/src/zig.rs
index b48f3cc..68fcfb2 100644
--- a/src/zig.rs
+++ b/src/zig.rs
@@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
 use std::process::{self, Command};
 use std::str;
 
-use anyhow::{bail, Context, Result};
+use anyhow::{anyhow, bail, Context, Result};
 use fs_err as fs;
 use path_slash::PathBufExt;
 use serde::Deserialize;
@@ -446,43 +446,32 @@ impl Zig {
                 cmd.env("CARGO_TARGET_APPLIES_TO_HOST", "false");
             }
 
-            // bindgen support
-            if let Ok(lib_dir) = Zig::lib_dir() {
-                // Bindgen env vars
-                let bindgen_env = "BINDGEN_EXTRA_CLANG_ARGS";
-                let bindgen_target_env = format!("{}_{}", bindgen_env, env_target);
-                // Closure to add bindgen env vars
-                let add_bindgen_env = |value| {
-                    if env::var_os(&bindgen_env).is_none()
-                        && env::var_os(&bindgen_target_env).is_none()
-                    {
-                        // Only set bindgen env vars if none were set
-                        cmd.env(bindgen_target_env, value);
-                    }
-                };
+            // Pass options used by zig cc down to bindgen, if possible
+            if let Ok(mut options) = Self::collect_zig_cc_options(&zig_wrapper, raw_target) {
+                if raw_target.contains("apple-darwin") {
+                    // everyone seems to miss `#import <TargetConditionals.h>`...
+                    options.push("-DTARGET_OS_IPHONE=0".to_string());
+                }
 
-                let libc = lib_dir.join("libc");
-                if raw_target.contains("linux") {
-                    if raw_target.contains("musl") {
-                        add_bindgen_env(format!("--sysroot={}", libc.join("musl").display()));
-                    } else if raw_target.contains("gnu") {
-                        add_bindgen_env(format!("--sysroot={}", libc.join("glibc").display()));
-                    }
-                } else if raw_target.contains("windows-gnu") {
-                    add_bindgen_env(format!("--sysroot={}", libc.join("mingw").display()));
-                } else if raw_target.contains("apple-darwin") {
-                    if let Some(sdkroot) = Self::macos_sdk_root() {
-                        add_bindgen_env(format!(
-                            "-I{} -F{} -DTARGET_OS_IPHONE=0",
-                            sdkroot.join("usr").join("include").display(),
-                            sdkroot
-                                .join("System")
-                                .join("Library")
-                                .join("Frameworks")
-                                .display()
-                        ));
+                let escaped_options = shlex::join(options.iter().map(|s| &s[..]));
+
+                // Override bindgen variables to append additional options
+                let bindgen_env = "BINDGEN_EXTRA_CLANG_ARGS";
+                let fallback_value = env::var(bindgen_env);
+                for target in [&env_target[..], parsed_target] {
+                    let name = format!("{bindgen_env}_{target}");
+                    if let Ok(mut value) = env::var(&name).or(fallback_value.clone()) {
+                        if shlex::split(&value).is_none() {
+                            // bindgen treats the whole string as a single argument if split fails
+                            value = shlex::quote(&value).into_owned();
+                        }
+                        if !value.is_empty() {
+                            value.push(' ');
+                        }
+                        value.push_str(&escaped_options);
+                        env::set_var(name, value);
                     } else {
-                        add_bindgen_env(format!("--sysroot={}", libc.join("darwin").display()));
+                        env::set_var(name, escaped_options.clone());
                     }
                 }
             }
@@ -490,6 +479,228 @@ impl Zig {
         Ok(())
     }
 
+    /// Collects compiler options used by `zig cc` for given target.
+    /// Used for the case where `zig cc` cannot be used but underlying options should be retained,
+    /// for example, as in bindgen (which requires libclang.so and thus is independent from zig).
+    fn collect_zig_cc_options(zig_wrapper: &ZigWrapper, raw_target: &str) -> Result<Vec<String>> {
+        #[derive(Debug, PartialEq, Eq)]
+        enum Kind {
+            Normal,
+            Framework,
+        }
+
+        #[derive(Debug)]
+        struct PerLanguageOptions {
+            glibc_minor_ver: Option<u32>,
+            include_paths: Vec<(Kind, String)>,
+        }
+
+        fn collect_per_language_options(program: &Path, ext: &str) -> Result<PerLanguageOptions> {
+            // We can't use `-x c` or `-x c++` because pre-0.11 Zig doesn't handle them
+            let empty_file_path = cache_dir().join(format!(".intentionally-empty-file.{ext}"));
+            fs::write(&empty_file_path, "")?;
+
+            let output = Command::new(program)
+                .arg("-E")
+                .arg(&empty_file_path)
+                .arg("-v")
+                .output()?;
+            // Clang always generates UTF-8 regardless of locale, so this is okay.
+            let stderr = String::from_utf8(output.stderr)?;
+            if !output.status.success() {
+                bail!(
+                    "Failed to run `zig cc -v` with status {}: {}",
+                    output.status,
+                    stderr.trim(),
+                );
+            }
+
+            // Collect some macro definitions from cc1 options. We can't directly use
+            // them though, as we can't distinguish options added by zig from options
+            // added by clang driver (e.g. `__GCC_HAVE_DWARF2_CFI_ASM`).
+            let glibc_minor_ver = if let Some(start) = stderr.find("__GLIBC_MINOR__=") {
+                let stderr = &stderr[start + 16..];
+                let end = stderr
+                    .find(|c| !matches!(c, '0'..='9'))
+                    .unwrap_or(stderr.len());
+                stderr[..end].parse().ok()
+            } else {
+                None
+            };
+
+            let start = stderr
+                .find("#include <...> search starts here:")
+                .ok_or_else(|| anyhow!("Failed to parse `zig cc -v` output"))?
+                + 34;
+            let end = stderr
+                .find("End of search list.")
+                .ok_or_else(|| anyhow!("Failed to parse `zig cc -v` output"))?;
+
+            let mut include_paths = Vec::new();
+            for mut line in stderr[start..end].lines() {
+                line = line.trim();
+                let mut kind = Kind::Normal;
+                if line.ends_with(" (framework directory)") {
+                    line = line[..line.len() - 22].trim();
+                    kind = Kind::Framework;
+                } else if line.ends_with(" (headermap)") {
+                    bail!("C/C++ search path includes header maps, which are not supported");
+                }
+                if !line.is_empty() {
+                    include_paths.push((kind, line.to_owned()));
+                }
+            }
+
+            Ok(PerLanguageOptions {
+                include_paths,
+                glibc_minor_ver,
+            })
+        }
+
+        let c_opts = collect_per_language_options(&zig_wrapper.cc, "c")?;
+        let cpp_opts = collect_per_language_options(&zig_wrapper.cxx, "cpp")?;
+
+        // Ensure that `c_opts` and `cpp_opts` are almost identical in the way we expect.
+        if c_opts.glibc_minor_ver != cpp_opts.glibc_minor_ver {
+            bail!(
+                "`zig cc` gives a different glibc minor version for C ({:?}) and C++ ({:?})",
+                c_opts.glibc_minor_ver,
+                cpp_opts.glibc_minor_ver,
+            );
+        }
+        let c_paths = c_opts.include_paths;
+        let mut cpp_paths = cpp_opts.include_paths;
+        let (cpp_pre_len, cpp_post_len) = if cpp_paths.starts_with(&c_paths) {
+            (0, cpp_paths.len() - c_paths.len())
+        } else if cpp_paths.ends_with(&c_paths) {
+            (cpp_paths.len() - c_paths.len(), 0)
+        } else {
+            bail!("C++ search path used by `zig cc` is unexpectedly different from C search path!");
+        };
+        if !cpp_paths[..cpp_pre_len]
+            .iter()
+            .chain(cpp_paths[cpp_paths.len() - cpp_post_len..].iter())
+            .all(|(kind, _)| *kind == Kind::Normal)
+        {
+            bail!("C++ search path used by `zig cc` contains additional special search paths!");
+        }
+
+        // <digression>
+        //
+        // So, why we do need all of these?
+        //
+        // Bindgen wouldn't look at our `zig cc` (which doesn't contain `libclang.so` anyway),
+        // but it does collect include paths from the local clang and feed them to `libclang.so`.
+        // We want those include paths to come from our `zig cc` instead of the local clang.
+        // There are three main mechanisms possible:
+        //
+        // 1. Replace the local clang with our version.
+        //
+        //    Bindgen, internally via clang-sys, recognizes `CLANG_PATH` and `PATH`.
+        //    They are unfortunately a global namespace and simply setting them may break
+        //    existing build scripts, so we can't confidently override them.
+        //
+        //    Clang-sys can also look at target-prefixed clang if arguments contain `-target`.
+        //    Unfortunately clang-sys can only recognize `-target xxx`, which very slightly
+        //    differs from what bindgen would pass (`-target=xxx`), so this is not yet possible.
+        //
+        //    It should be also noted that we need to collect not only include paths
+        //    but macro definitions added by Zig, for example `-D__GLIBC_MINOR__`.
+        //    Clang-sys can't do this yet, so this option seems less robust than we want.
+        //
+        // 2. Set the environment variable `BINDGEN_EXTRA_CLANG_ARGS` and let bindgen to
+        //    append them to arguments passed to `libclang.so`.
+        //
+        //    This unfortunately means that we have the same set of arguments for C and C++.
+        //    Also we have to support older versions of clang, as old as clang 5 (2017).
+        //    We do have options like `-c-isystem` (cc1 only) and `-cxx-isystem`,
+        //    but we need to be aware of other options may affect our added options
+        //    and this requires a nitty gritty of clang driver and cc1---really annoying.
+        //
+        // 3. Fix either bindgen or clang-sys or Zig to ease our jobs.
+        //
+        //    This is not the option for now because, even after fixes, we have to support
+        //    older versions of bindgen or Zig which won't have those fixes anyway.
+        //    But it seems that minor changes to bindgen can indeed fix lots of issues
+        //    we face, so we are looking for them in the future.
+        //
+        // For this reason, we chose the option 2 and overrode `BINDGEN_EXTRA_CLANG_ARGS`.
+        // The following therefore assumes some understanding about clang option handling,
+        // including what the heck is cc1 (see the clang FAQ) and how driver options get
+        // translated to cc1 options (no documentation at all, as it's supposedly unstable).
+        // Fortunately for us, most (but not all) `-i...` options are passed through cc1.
+        //
+        // If you do experience weird compilation errors during bindgen, there's a chance
+        // that this code has overlooked some edge cases. You can put `.clang_arg("-###")`
+        // to print the final cc1 options, which would give a lot of information about
+        // how it got screwed up and help a lot when we fix the issue.
+        //
+        // </digression>
+
+        let mut args = Vec::new();
+
+        // Never include default include directories,
+        // otherwise `__has_include` will be totally confused.
+        args.push("-nostdinc".to_owned());
+
+        // Add various options for libc++ and glibc.
+        // Should match what `Compilation.zig` internally does:
+        //
+        // https://github.com/ziglang/zig/blob/0.9.0/src/Compilation.zig#L3390-L3427
+        // https://github.com/ziglang/zig/blob/0.9.1/src/Compilation.zig#L3408-L3445
+        // https://github.com/ziglang/zig/blob/0.10.0/src/Compilation.zig#L4163-L4211
+        // https://github.com/ziglang/zig/blob/0.10.1/src/Compilation.zig#L4240-L4288
+        if raw_target.contains("musl") {
+            args.push("-D_LIBCPP_HAS_MUSL_LIBC".to_owned());
+        }
+        args.push("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS".to_owned());
+        args.push("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS".to_owned());
+        args.push("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS".to_owned());
+        args.push("-D_LIBCPP_ABI_VERSION=1".to_owned());
+        args.push("-D_LIBCPP_ABI_NAMESPACE=__1".to_owned());
+        if let Some(ver) = c_opts.glibc_minor_ver {
+            // Handled separately because we have no way to infer this without Zig
+            args.push(format!("-D__GLIBC_MINOR__={ver}"));
+        }
+
+        for (kind, path) in cpp_paths.drain(..cpp_pre_len) {
+            assert!(kind == Kind::Normal);
+            // Ideally this should be `-stdlib++-isystem`, which can be disabled by
+            // passing `-nostdinc++`, but it is fairly new: https://reviews.llvm.org/D64089
+            //
+            // (Also note that `-stdlib++-isystem` is a driver-only option,
+            // so it will be moved relative to other `-isystem` options against our will.)
+            args.push("-cxx-isystem".to_owned());
+            args.push(path);
+        }
+
+        for (kind, path) in c_paths {
+            match kind {
+                Kind::Normal => {
+                    // A normal `-isystem` is preferred over `-cxx-isystem` by cc1...
+                    args.push("-Xclang".to_owned());
+                    args.push("-c-isystem".to_owned());
+                    args.push("-Xclang".to_owned());
+                    args.push(path.clone());
+                    args.push("-cxx-isystem".to_owned());
+                    args.push(path);
+                }
+                Kind::Framework => {
+                    args.push("-iframework".to_owned());
+                    args.push(path);
+                }
+            }
+        }
+
+        for (kind, path) in cpp_paths.drain(cpp_paths.len() - cpp_post_len..) {
+            assert!(kind == Kind::Normal);
+            args.push("-cxx-isystem".to_owned());
+            args.push(path);
+        }
+
+        Ok(args)
+    }
+
     fn setup_os_deps(
         manifest_path: Option<&Path>,
         release: bool,


Test patch:
diff --git a/tests/bindgen-exhaustive/Cargo.lock b/tests/bindgen-exhaustive/Cargo.lock
new file mode 100644
index 0000000..6ba46aa
--- /dev/null
+++ b/tests/bindgen-exhaustive/Cargo.lock
@@ -0,0 +1,250 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "bindgen"
+version = "0.65.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
+dependencies = [
+ "bitflags",
+ "cexpr",
+ "clang-sys",
+ "lazy_static",
+ "lazycell",
+ "log",
+ "peeking_take_while",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash",
+ "shlex",
+ "syn",
+ "which",
+]
+
+[[package]]
+name = "bindgen-exhaustive"
+version = "0.1.0"
+dependencies = [
+ "bindgen",
+]
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clang-sys"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "either"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+
+[[package]]
+name = "glob"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "lazycell"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+
+[[package]]
+name = "libc"
+version = "0.2.146"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
+
+[[package]]
+name = "libloading"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
+dependencies = [
+ "cfg-if",
+ "winapi",
+]
+
+[[package]]
+name = "log"
+version = "0.4.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
+
+[[package]]
+name = "memchr"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+
+[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+
+[[package]]
+name = "peeking_take_while"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
+
+[[package]]
+name = "prettyplease"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b69d39aab54d069e7f2fe8cb970493e7834601ca2d8c65fd7bbd183578080d1"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.60"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
+dependencies = [
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
+
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
+[[package]]
+name = "shlex"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
+
+[[package]]
+name = "syn"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
+
+[[package]]
+name = "which"
+version = "4.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
+dependencies = [
+ "either",
+ "libc",
+ "once_cell",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/tests/bindgen-exhaustive/Cargo.toml b/tests/bindgen-exhaustive/Cargo.toml
new file mode 100644
index 0000000..1999c67
--- /dev/null
+++ b/tests/bindgen-exhaustive/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "bindgen-exhaustive"
+version = "0.1.0"
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[build-dependencies]
+bindgen = "0.65.1"
diff --git a/tests/bindgen-exhaustive/build.rs b/tests/bindgen-exhaustive/build.rs
new file mode 100644
index 0000000..2694ec4
--- /dev/null
+++ b/tests/bindgen-exhaustive/build.rs
@@ -0,0 +1,62 @@
+use std::{env, path::PathBuf};
+
+fn main() {
+    println!("cargo:rerun-if-changed=sys/sysdep.h");
+    println!("cargo:rerun-if-changed=sys/isoc.h");
+    println!("cargo:rerun-if-changed=sys/isocpp.hpp");
+
+    generate(
+        bindgen::Builder::default()
+            .header("src/sysdep.h")
+            .header("src/isoc.h")
+            .allowlist_type(r"zigbuild_.*"),
+        "c.rs",
+    );
+
+    generate(
+        bindgen::Builder::default()
+            .header("src/sysdep.h")
+            .header("src/isocpp.hpp")
+            .allowlist_type(r"zigbuild_.*"),
+        "cpp.rs",
+    );
+}
+
+fn generate(builder: bindgen::Builder, filename: &str) {
+    // Tip: use `-###` to see cc1 options (`-v` normally prints them, but not in this case)
+    let builder = builder
+        .clang_arg("-v")
+        .parse_callbacks(Box::new(bindgen::CargoCallbacks));
+
+    match builder.generate() {
+        Ok(bindings) => {
+            bindings
+                .write_to_file(PathBuf::from(env::var_os("OUT_DIR").unwrap()).join(filename))
+                .unwrap();
+        }
+        Err(e) => {
+            eprintln!();
+
+            // print (lightly formatted) BINDGEN_EXTRA_CLANG_ARGS for diagnostics
+            let target = env::var("TARGET").unwrap().replace("-", "_");
+            let bindgen_env = format!("BINDGEN_EXTRA_CLANG_ARGS_{target}");
+            if let Ok(value) = env::var(&bindgen_env) {
+                eprintln!("{bindgen_env}:");
+                for arg in value.split_whitespace() {
+                    eprintln!("  {arg}");
+                }
+                eprintln!();
+            }
+
+            if let bindgen::BindgenError::ClangDiagnostic(s) = e {
+                // `cargo build` will print stderr anyway, let's cut it
+                panic!(
+                    "Failed to invoke clang (see above for the full message):\n{:.500}",
+                    s
+                );
+            } else {
+                panic!("{}", e);
+            }
+        }
+    }
+}
diff --git a/tests/bindgen-exhaustive/src/isoc.h b/tests/bindgen-exhaustive/src/isoc.h
new file mode 100644
index 0000000..9b88a87
--- /dev/null
+++ b/tests/bindgen-exhaustive/src/isoc.h
@@ -0,0 +1,29 @@
+#include <assert.h>
+#include <complex.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fenv.h>
+#include <float.h>
+#include <inttypes.h>
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdalign.h>
+#include <stdarg.h>
+#include <stdatomic.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdnoreturn.h>
+#include <string.h>
+#include <tgmath.h>
+//#include <threads.h> // mingw doesn't have one
+#include <time.h>
+//#include <uchar.h> // darwin doesn't have one
+#include <wchar.h>
+#include <wctype.h>
\ No newline at end of file
diff --git a/tests/bindgen-exhaustive/src/isocpp.hpp b/tests/bindgen-exhaustive/src/isocpp.hpp
new file mode 100644
index 0000000..108348d
--- /dev/null
+++ b/tests/bindgen-exhaustive/src/isocpp.hpp
@@ -0,0 +1,138 @@
+// libcxx versions vendored by Zig:
+//
+//           v--- _LIBCPP_VERSION
+// 13.0.0 (13000)      Zig 0.9.x
+// 15.0.3 (15003)      Zig 0.10.x
+// 16.0.1 (160001)     Zig 0.11.0 (master, as of 2023-04)
+
+#include <algorithm>
+#include <any>
+#include <array>
+#include <atomic>
+#include <barrier>
+#include <bit>
+#include <bitset>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <charconv>
+#include <chrono>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <codecvt>
+#include <compare>
+#include <complex>
+#include <concepts>
+#include <condition_variable>
+#if _LIBCPP_VERSION >= 15000
+	#include <coroutine>
+#endif
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#if _LIBCPP_VERSION >= 15000
+	#include <cuchar>
+#endif
+#include <cwchar>
+#include <cwctype>
+#include <deque>
+#include <exception>
+#include <execution>
+#include <filesystem>
+#include <format>
+#include <forward_list>
+#include <fstream>
+#include <functional>
+#include <future>
+#include <initializer_list>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <latch>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#if _LIBCPP_VERSION >= 160000
+	#include <memory_resource>
+#endif
+#include <mutex>
+#include <new>
+#include <numbers>
+#include <numeric>
+#include <optional>
+#include <ostream>
+#include <queue>
+#include <random>
+#include <ranges>
+#include <ratio>
+#include <regex>
+#include <scoped_allocator>
+#include <semaphore>
+#include <set>
+#include <shared_mutex>
+#if _LIBCPP_VERSION >= 160000
+	#include <source_location>
+#endif
+#include <span>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+//#include <stop_token> // not yet supported by libc++ (git only)
+#include <streambuf>
+#include <string>
+#include <string_view>
+#include <strstream>
+//#include <syncstream> // not yet supported by libc++
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <variant>
+#include <vector>
+#include <version>
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fenv.h>
+#include <float.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#if _LIBCPP_VERSION >= 15000
+	#include <uchar.h>
+#endif
+#include <wchar.h>
+#include <wctype.h>
+
diff --git a/tests/bindgen-exhaustive/src/lib.rs b/tests/bindgen-exhaustive/src/lib.rs
new file mode 100644
index 0000000..8435695
--- /dev/null
+++ b/tests/bindgen-exhaustive/src/lib.rs
@@ -0,0 +1,39 @@
+#![allow(
+    non_upper_case_globals,
+    non_camel_case_types,
+    non_snake_case,
+    dead_code,
+    improper_ctypes
+)]
+
+mod c {
+    include!(concat!(env!("OUT_DIR"), "/c.rs"));
+
+    // verify that sysdep.h generates specific types
+    const _: () = {
+        #[cfg(target_os = "linux")]
+        zigbuild_is_linux { x: 0 };
+
+        #[cfg(target_os = "windows")]
+        zigbuild_is_win32 { x: 0 };
+
+        #[cfg(target_os = "macos")]
+        zigbuild_is_macos { x: 0 };
+    };
+}
+
+mod cpp {
+    include!(concat!(env!("OUT_DIR"), "/cpp.rs"));
+
+    // verify that sysdep.h generates specific types
+    const _: () = {
+        #[cfg(target_os = "linux")]
+        zigbuild_is_linux { x: 0 };
+
+        #[cfg(target_os = "windows")]
+        zigbuild_is_win32 { x: 0 };
+
+        #[cfg(target_os = "macos")]
+        zigbuild_is_macos { x: 0 };
+    };
+}
diff --git a/tests/bindgen-exhaustive/src/sysdep.h b/tests/bindgen-exhaustive/src/sysdep.h
new file mode 100644
index 0000000..ba70979
--- /dev/null
+++ b/tests/bindgen-exhaustive/src/sysdep.h
@@ -0,0 +1,44 @@
+#if defined __has_include
+	#if __has_include(<linux/netfilter.h>)
+		#define HAS_LINUX_HEADER
+	#endif
+	#if __has_include(<winsock2.h>)
+		#define HAS_WINDOWS_HEADER
+	#endif
+	#if __has_include(<mach/mach_time.h>)
+		#define HAS_MACOS_HEADER
+	#endif
+#endif
+
+#ifdef __linux__
+	struct zigbuild_is_linux { int x; };
+	#if defined __has_include && !defined HAS_LINUX_HEADER
+		#error "linux targets are expected to have <linux/netfilter.h>"
+	#endif
+#else
+	#if defined __has_include && defined HAS_LINUX_HEADER
+		#error "non-linux targets mistakenly have <linux/netfilter.h>, probably from host includes"
+	#endif
+#endif
+
+#ifdef _WIN32
+	struct zigbuild_is_win32 { int x; };
+	#if defined __has_include && !defined HAS_WINDOWS_HEADER
+		#error "windows targets are expected to have <winsock2.h>"
+	#endif
+#else
+	#if defined __has_include && defined HAS_WINDOWS_HEADER
+		#error "non-windows targets mistakenly have <winsock2.h>, probably from host includes"
+	#endif
+#endif
+
+#if defined __APPLE__ && defined __MACH__
+	struct zigbuild_is_macos { int x; };
+	#if defined __has_include && !defined HAS_MACOS_HEADER
+		#error "macos targets are expected to have <mach/mach_time.h>"
+	#endif
+#else
+	#if defined __has_include && defined HAS_MACOS_HEADER
+		#error "non-macos targets mistakenly have <mach/mach_time.h>, probably from host includes"
+	#endif
+#endif