Skip to content

Build fails with v0.2.11 on crates.io after updating to Clang 16 #75

Closed
@publictheta

Description

@publictheta

After updating to Clang (LLVM) 16, building coreaudio-sys v0.2.11 from crate.io began to fail with errors like "enum_(unnamed_at_...)" is not a valid Ident.

Here is a detailed log:

   Compiling coreaudio-sys v0.2.11
error: failed to run custom build command for `coreaudio-sys v0.2.11`

Caused by:
  process didn't exit successfully: `/Users/me/Developer/rust-coreaudio-sys-issue/target/debug/build/coreaudio-sys-7020e5761942a687/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=COREAUDIO_SDK_PATH
  cargo:rustc-link-lib=framework=AudioUnit
  cargo:rustc-link-lib=framework=AudioToolbox
  cargo:rustc-link-lib=framework=CoreAudio
  cargo:rustc-link-lib=framework=OpenAL
  cargo:rustc-link-lib=framework=CoreMIDI
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

  --- stderr
  thread 'main' panicked at '"enum_(unnamed_at_/Library/Developer/CommandLineTools/SDKs/MacOSX_sdk/usr/include/MacTypes_h_382_1)" is not a valid Ident', /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/fallback.rs:780:9
stack backtrace:
     0: rust_begin_unwind
               at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/std/src/panicking.rs:575:5
     1: core::panicking::panic_fmt
               at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/core/src/panicking.rs:64:14
     2: proc_macro2::fallback::validate_ident
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/fallback.rs:780:9
     3: proc_macro2::fallback::Ident::_new
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/fallback.rs:722:9
     4: proc_macro2::fallback::Ident::new
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/fallback.rs:732:9
     5: proc_macro2::imp::Ident::new
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/wrapper.rs:701:50
     6: proc_macro2::Ident::new
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.53/src/lib.rs:970:21
     7: bindgen::ir::context::BindgenContext::rust_ident_raw
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/ir/context.rs:859:9
     8: bindgen::ir::context::BindgenContext::rust_ident
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/ir/context.rs:851:9
     9: <bindgen::ir::enum_ty::Enum as bindgen::codegen::CodeGenerator>::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:3036:21
    10: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:1040:39
    11: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:501:17
    12: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:524:21
    13: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:554:13
    14: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:492:17
    15: bindgen::codegen::codegen::{{closure}}
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:4498:9
    16: bindgen::ir::context::BindgenContext::gen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/ir/context.rs:1174:19
    17: bindgen::codegen::codegen
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/codegen/mod.rs:4462:5
    18: bindgen::Bindings::generate
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/lib.rs:2545:43
    19: bindgen::Builder::generate
               at /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.61.0/lib.rs:1580:9
    20: build_script_build::build
               at ./build.rs:150:20
    21: build_script_build::main
               at ./build.rs:165:5
    22: core::ops::function::FnOnce::call_once
               at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/core/src/ops/function.rs:250:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This seems to be caused by a change in Clang's behavior mentioned in this fixed issue for the bindgen crate, and it is not occurring in the master branch of coreaudio-sys because Dependabot updated bindgen from v0.61 to v0.64.

As a temporary workaround, I have added the following patch section to my Cargo.toml, but I believe that once the current master branch is released on crates.io, it will help prevent unexpected build errors for users of crates that depend on this crate.

[patch.crates-io]
coreaudio-sys = { git = "https://github.com/RustAudio/coreaudio-sys.git" }

I hope this is helpful:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions