-
Notifications
You must be signed in to change notification settings - Fork 379
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
Investigate bindgen woes - "file not found" #1389
Comments
Should we add |
gives
**edit
aarch64-unknown-linux-gnu example # Cross.toml
[target.aarch64-unknown-linux-gnu.env]
passthrough = ["""BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_gnu=--sysroot=/usr/aarch64-linux-gnu -idirafter/usr/include"""] gives
I've updated the first post from using |
I think |
Some more investigating, pkg-config strips
|
Another issue, should we really use |
I'm not entirely sure of the problem this issue is about, since not all containers use the same approach. Since you mention using Ubuntu's |
Maybe I'm the one that is confused, we set the env var in #707 I was under the impression that it was needed, but maybe it wasn't needed for every target, and only needed for android |
@Emilgardis In my case, I'm using This works just fine with the default toolchain/target, but cross-compiling without |
@tniessen short answer is no, cross wouldnt help with a more elegant solution, the solution would be equally applicable with or without cross. I dont think your specific example here is related to what this issue is about, but feel free to open a new issue with more information and maybe we can work something out |
I'll close this issue with #1391 |
Some (if not most?)
*-dev
packages on ubuntu dist only include headers in/usr/include
, this means that theBINDGEN_EXTRA_CLANG_ARGS_<target>=--sysroot=$CROSS_SYSROOT
that we set in our images meansbindgen
can't properly find these headers if the*-sys
-crate doesn't usepkg-config
probing.bindgen
errors with:Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'mylib.h' file not found\n")
To solve this problem, there's two options, nr.1 requires a change in the
sys
-crate1. Modify the
sys
-crateCrates using bindgen for API generation can do the following
2. modify
BINDGEN_EXTRA_CLANG_ARGS_<target>
to include/usr/include
(make sure to get the correct sysroot path and use the correct target names,
<target>
is lowercase snake_case target triple,<TARGET>
is uppercase kebab-case target triple.)Going forward
I've filed rust-lang/rust-bindgen#2701 to potentially make option 2 easier, as we then could just set
BINDGEN_EXTRA_CLANG_ARGS=-idirafter/usr/include
for all targets and all is well.Can we solve this problem in our images?
Related: rust-lang/rust-bindgen#1247 for pkg-config with bindgen.
The text was updated successfully, but these errors were encountered: