-
Notifications
You must be signed in to change notification settings - Fork 741
'TranslationUnit::parse failed' on aarch64-apple-ios since Bindgen 0.31 #1211
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
Comments
I have the same issue when running bindgen using API - it doesn't work when the build target is set to "aarch64-apple-ios".
It fails when the newest bindgen is used, but it seems to work fine at 0.30.0 version. |
Does it work if you set |
You mean trying to run bindgen from command line instead of from build.rs? |
No I mean passing explicitly the target via clang_arg / clang_args. |
Like I said in my original bug description, passing |
I have this same issue with v0.50.0 when building via rust-bindgen/src/ir/context.rs Line 567 in 18a64e6
@emilio If I detect and replace This codebase does a similar thing. |
Ugh, what a mess. Yeah, that'd work, I think. I don't think we look at particular targets much further down the pipeline, so it should be fine if it works. |
http://lists.llvm.org/pipermail/llvm-dev/2017-March/110993.html:
It's still pretty 🤢if you ask me though. Would it be reasonable to have bindgen transform the |
@simlay FWIW, I've never had issues using --target on Darwin, even though -arch is maybe more "canonical". But yeah: Apple doesn't consider their architecture to be "aarch64", and in fact I would go so far as to note that they didn't actually implement the aarch64 calling convention "to spec", and so I've always felt "arm64" is simply a different beast entirely; but like, since Rust (as well as a lot of other projects: Rust is in good company) has decided to use the name aarch64 here, you definitely should transform the name before passing it to clang. Regardless, I will call attention to one of these patches that has referenced this issue, where a downstream project was able to mess with the arguments to bindgen to use arm64- with --target= (not needing to use -arch) and it worked. Do I need to go get other downstream projects (the one I'm working with is nettle-sys) to add a similar workaround, is there a way I can apply this workaround using RUSTFLAGS, or is the "detect --target=aarch64-apple-ios and change it --target=arm64-apple-ios" something that can get added to bindgen? godot-rust/gdnative@b21f2ef#diff-ef40f7a2ddacebe98cfa82c6697f2598R76 |
So what is final conclusion here? And this issue not only with iOS, for example there is cargo/rustc tripple
so bindgen can generate wrong code for header file when targeting android. |
So it seems like the issue is that the clang triple and the rust triple are different. So we need to change this code to pass something like |
It seems like aarch64-apple-* is arm64-apple-*. |
Interestingly, on the command line, plain clang takes both, but Xcode clang only takes the latter. |
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 onaarch64-apple-ios
. Using the command line bindgen gives me the same result.My setup:
My header:
Bindgen Invocation:
Actual Results:
Found out a mention that "arm64" instead of "aarch64" could be passed to clang, which apparently works:
Gives me
And it also works like before on all the other architectures I use:
Thanks !
The text was updated successfully, but these errors were encountered: