Forward CXX env and arguments from cargo_build_script#1004
Forward CXX env and arguments from cargo_build_script#1004ikalchev wants to merge 2 commits intobazelbuild:mainfrom
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
|
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 |
|
Closing per #1003 (comment) |
We need to forward the C++ command line arguments and env to
bin.rsto make sure cargo_build libraries are compiled with the same options
as
cc_*targets.Fixes #1003