-
Notifications
You must be signed in to change notification settings - Fork 742
thread 'main' panicked at 'TranslationUnit::parse failed', libcore/option.rs:960:5 - with --target=path/to/target.json #1331
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
(Probably worth mentioning that I'm not positive this is a bindgen vs. a cargo bug, but bindgen lost the coin flip 😬 ) |
I am experiencing the same thing when running
|
I am experiencing this when using
|
That means that the arguments are probably invalid. |
Would it be possible to get the error output from libclang itself in order to give a more descriptive error about what went wrong? I finally got this to work by passing |
Let's keep this issue for the first comment, which I still haven't had time to investigate (sorry @alex!). The failure in #1331 (comment) is due to invalid arguments. I'm aware that this error message is not great at all, but right now there's no way (at least that I know of) to get a more sensible error message from libclang. I could try to submit patches to libclang to improve this, I've done that for other stuff in the past, but not sure I'll have the time for it. Possible errors for this message include: bogus flags, unknown file / directories passed into clang, etc... We could try to some guessing, but it'd be just that, guessing. You need (again, AFAIK) a translation unit to get diagnostics from clang. |
Yeah, that's a shame. A patch to libclang would obviously be nice eventually, but of course that'd take time. For the time being, perhaps a message like "libclang error; possible reasons include invalid arguments, missing files, ". At least that way, it'd make it clear that it's an opaque error from libclang and we can't give any more detail. |
Yeah, that sounds reasonable to me, it's really hard to have a worse error message than what we have now ;). Want to submit a PR for that? Otherwise I can get to it when I have a bit of free time. Thanks! |
I'm happy to submit a PR, but do you happen to know what a more complete set of examples would be? I'd like it to be as exhaustive as possible. So far, you mentioned:
Anything else? |
Nothing else comes to mind off-hand... Probably worth mentioning in the error message to file an issue if the cause of the particular error isn't listed there? :) |
Sounds good! |
cargo
recently gained the ability for--target
to point a JSON file, instead of being the name of a target found inRUST_TARGET_PATH
.Using
bindgen
in a build script when compiling with--target=path/to/target.json
produces sadness:Full output in CI at https://travis-ci.org/alex/linux-kernel-module-rust/builds/392023111
And the diff showing the change that produces this at https://github.com/alex/linux-kernel-module-rust/pull/50/files
The text was updated successfully, but these errors were encountered: