-
Notifications
You must be signed in to change notification settings - Fork 477
Forward CXX env and arguments from cargo_build_script #1004
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
base: main
Are you sure you want to change the base?
Conversation
We need to forward the C++ command line arguments and env to ``bin.rs`` to make sure cargo_build libraries are compiled with the same options as `cc_*` targets. Fixes bazelbuild#1003
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These arguments can contain paths relative to the exec root, i.e. "external/androidndk/...' when cross-compiling for android (and perhaps other targets). |
@JasperDeSutter What kind of symlink are you suggesting? |
A directory symlink mapping exec_root/external to CARGO_MANIFEST_DIR/external before running the build script. I'm not sure how many bazel rules this breaks, but I hacked it into cargo_build_script_runner's bin.rs and that seems to work. |
I see! Yeah, this could work, and would I imagine cover most of the use-cases people actually hit - it's possible that toolchains can point at files in-repo rather than in a separate workspace (hidden behind I had been considering doing some on-the-fly flag editing to basically for each flag, if resolving it from the exec-root it happens to be an existing file/directory, to absolutify the flag, but that feels pretty invasive. The symlink feels like a pretty reasonable middle-ground to make most things work most of the time without breaking much (and we can add a "don't create external symlink" attribute to |
We need to forward the C++ command line arguments and env to
bin.rs
to make sure cargo_build libraries are compiled with the same options
as
cc_*
targets.Fixes #1003