-
Notifications
You must be signed in to change notification settings - Fork 702
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
Document providing include paths and FAQ for missing system headers #1226
Comments
This is probably better suited for https://github.com/KyleMayes/clang-sys. That's the crate bindgen uses for figuring out system headers. I agree that if this is a common problem, it'd be nice to document it, though. Thanks for the report :) |
For the most part, I would love to merge some PRs adding more documentation / FAQs about this stuff though! |
I was experiencing this issue on Ubuntu 17.10 compiling a simple C file including stddef.h. I investigated and was able to fix it by making bindgen pass the C search paths to the driver when it detects that it is compiling C. See pull request #1351 |
I have the 'stddef.hI' issue. I'm on macOS 10.13.6, latest command line tools installed.
Generating C bindings works fine. I tried with several different C++ headers as input for bindgen. I always get this error.
bindgen 0.41.0 I tried adding some (and even all) of the above paths as clang args in |
Is there a known solution to this problem? |
Each problem is generally different depending on the setup. Could you file a separate issue pointing out which libclang are you using, and the first few lines of running bindgen with |
I have not managed to find a solution for this. It's basically the reason why bindgen is useless for me on macOS for certain projects that depend on system headers. |
Although it may not be rust-bindgen's problem, but it hurts user experiences of rust-bindgen badly. Hope to find a way to fix it permanently. |
I had similar problem when building Firefox codebase and the solution was to point auto-tools script to clang installed in CommandLineTools:
Not sure how to set this up in rust world thus i did something ugly:
The above "fix" is just work-around for impatient souls who ended up here and do not know rust and mac ecosystem well enough ;) |
Any news on that? it's failing to generate because it can't find some of the included headers. how do i pass a |
Could you share your |
You can specify |
How do you resolve framework header errors on macOS?
The path in the header is > locate CFAvailability.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFAvailability.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFAvailability.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFAvailability.h |
I solved this after RTF(Clang)M. The flag for finding macOS frameworks is In your .clang_arg("-F/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/") |
Got stuck on this same issue trying to build code inside a Docker container. Solution was to follow the instructions in the docs (i.e: make sure clang is installed) 😅. Some specifics about my situation, for future reference: Ubuntu 18.04 host, debian-based container, trying to build |
@KyussCaesar Maybe the fact that everyone here had clang installed correctly got lost in the number of replies. The doc section you quoted states about macOS you should install |
@virtualritz actually I was meaning to link to the part in the docs about Debian-based Linuxes. grepped this thread for "Docker" and found nothing, so thought it might be useful as a reminder to make sure clang is installed inside the container image. |
Sometimes there is a cryptic
fatal error: 'stddef.h' file not found
, presumabely when libclang is incorrectly configured:servo/gecko-media#71
rsmpi/rsmpi#1
#242
ajtulloch/caffe.rs#1
In the past, this issue was fixed by making sure to install the
clang
package or by finding the missing pathes and adding them to the includes.I was wondering whether bindgen could work around this issue? (The second solution above can be automated.) Alternatively, it could be documented how to fix it.
The text was updated successfully, but these errors were encountered: