youknowone/apple-sys

Build error when include ScreenCaptureKit

bigduu opened this issue · 2 comments

bigduu commented
apple-sys = { version = "*", features = ["ScreenCaptureKit"] }

/Users/bigduu/.cargo/registry/src/github.com-1ecc6299db9ec823/apple-sys-0.2.0/ScreenCaptureKit.h:1:2: fatal error: malformed or corrupted AST file: 'duplicate DECL_OFFSET record in AST file'
/Users/bigduu/.cargo/registry/src/github.com-1ecc6299db9ec823/apple-sys-0.2.0/ScreenCaptureKit.h:1:2: note: after modifying system headers, please delete the module cache at '/var/folders/xw/5cb3hk_x61zfbcyf_8ww7zlm0000gn/C/clang/ModuleCache/Z1130PPJ7JDN'
thread 'main' panicked at 'libclang error; possible causes include:

  • Invalid flag syntax
  • Unrecognized flags
  • Invalid flag arguments
  • File I/O errors
  • Host vs. target architecture mismatch
    If you encounter an error missing from this list, please file an issue or a PR!', /Users/bigduu/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.63.0/ir/context.rs:530:15
    stack backtrace:
    0: rust_begin_unwind
    at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
    1: core::panicking::panic_fmt
    at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
    2: core::panicking::panic_display
    at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:147:5
    3: core::panicking::panic_str
    at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:131:5
    4: core::option::expect_failed
    at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/option.rs:2045:5
    5: core::option::Option::expect
    6: bindgen::ir::context::BindgenContext::new
    7: bindgen::Bindings::generate
    8: bindgen::Builder::generate
    9: apple_bindgen::builder::Builder::generate
    10: build_script_build::main
    11: core::ops::function::FnOnce::call_once
    note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Could you share more details?
I can't reproduce it on macOS 13.3.1 with MacOSX13.3.sdk

Even more, It is libclang error. apple-sys doesn't have much things to do with libclang error. apple-sys uses bindgen, and bindgen uses libclang.

Please update llvm if your llvm version is an old one.