'TranslationUnit::parse failed' on aarch64-apple-ios since Bindgen 0.31 · Issue #1211 · rust-lang/rust-bindgen (original) (raw)

On my way trying to bump bindgen in my project from 0.26.3 to 0.32.1, found out that bindgen isn't working anymore from version 0.31 on the aarch64-apple-ios target, but is still working on other iOS and MacOS targets. I use Bindgen from a build.rs, which gets compiled for each target my project supports and fails on aarch64-apple-ios. Using the command line bindgen gives me the same result.

My setup:

My header:

typedef struct _foo_context foo_context; foo_context* foo_new(char* bar);

Bindgen Invocation:

$  RUST_BACKTRACE=1 bindgen --no-layout-tests --dump-preprocessed-input test.h -- --target=aarch64-apple-ios

Actual Results:

error: unknown target triple 'unknown-apple-macosx10.4.0', please use -triple or -arch

Found out a mention that "arm64" instead of "aarch64" could be passed to clang, which apparently works:

$ RUST_BACKTRACE=1 bindgen --no-layout-tests --dump-preprocessed-input test.h -- --target=arm64-apple-ios

Gives me

/* automatically generated by rust-bindgen */

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _foo_context {
    _unused: [u8; 0],
}
pub type foo_context = _foo_context;
extern "C" {
 # [ link_name = "\u{1}_foo_new" ]
    pub fn foo_new(bar: *mut ::std::os::raw::c_char) -> *mut foo_context;
}

And it also works like before on all the other architectures I use:

aarch64-linux-android
armv7-apple-ios
armv7-linux-androideabi
armv7s-apple-ios
i386-apple-ios
i686-linux-android
x86_64-apple-darwin
x86_64-apple-ios
x86_64-linux-android

Thanks !