-
Notifications
You must be signed in to change notification settings - Fork 65
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
v4l2-sys: Replace FreeBSD **host-only** include path override with docs #114
base: master
Are you sure you want to change the base?
Conversation
@MarijnS95, I actually didn't think about cross-compilation when we were working on the previous change. I think you are right that I agree with the solution you propose (removing existing workaround and relying-on/requiring |
@vladmovchan if you can confirm that this crate builds with |
I tried 6d17141 commit (the last commit before first PR has been merged) with minor additional change from
Without any extra environment variables, it produces expected error:
With When you are going to add this to documentation, please use environment variable name with all underscores ( Thank you! |
7ac2f1b
to
70838a1
Compare
All updated now, thanks for the wait and thanks for the test @vladmovchan! Let me know what you think about the new docs! |
It is a great explanation/documentation - I like it 👍 |
With `cfg!()` on `target_os` this include path is unconditionally used if the _host_ OS is FreeBSD, even if the target OS is different (and its cross-compilation headers are installed elsewhere on the system). The accurate target OS, regardless of what the build script is _running on_ is stored in `CARGO_CFG_TARGET_OS`. Since it is unlikely that the FreeBSD headers reside in `/usr/ local/include` when the *target* is FreeBSD while the host may be something completely different, remove the workaround and document how the user can set up arbitrary include directories for their target using `BINDGEN_EXTRA_CLANG_ARGS` (or the triple-specific variant) by documenting this environment variable in the main `README`. It is common for developers to maintain such a configuration in their home directory's `~/.cargo/ config.toml` for the various architectures that they cross-compile to (together with related variables for the linker and `cc-rs`).
70838a1
to
808b1de
Compare
In #106 we were too focused on getting rid of a
pkg-config
dependency via an unused system library, that acfg!()
inbuild.rs
slipped in.@vladmovchan can you help us check theDone!XXX
comment specifically? I think we should remove this workaround and instead require the caller to set the correct sysroot or include(s) viaBINDGEN_EXTRA_CLANG_ARGS_<triple>
to make sure cross-compilations works to and from FreeBSD.With
cfg!()
ontarget_os
this include path is unconditionally used if the host OS is FreeBSD, even if the target OS is different (and its cross-compilation headers are installed elsewhere on the system). The accurate target OS, regardless of what the build script is running on is stored inCARGO_CFG_TARGET_OS
.Since it is unlikely that the FreeBSD headers reside in
/usr/ local/include
when the target is FreeBSD while the host may be something completely different, remove the workaround and document how the user can set up arbitrary include directories for their target usingBINDGEN_EXTRA_CLANG_ARGS
(or the triple-specific variant) by documenting this environment variable in the mainREADME
. It is common for developers to maintain such a configuration in their home directory's~/.cargo/ config.toml
for the various architectures that they cross-compile to (together with related variables for the linker andcc-rs
).