-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
--action_env not forwarded through "tools" dependency #4008
Comments
Encountered the same problem trying to compile TensorFLow with CUDA and LD_LIBRARY_PATH: Nvidia's docs say using LD_LIBRARY_PATH is a way to set up compilation with cuda. This mostly works with the bazel/TensorFlow build, until we hit a host-compiled tool that links into cuda - the link then fails. |
I encountered the same bug trying to find out the cause of spurious rebuild because setting --action_env PATH=something will make all your build rebuild all host dependencies every time your PATH change :( My repro:
(With bazel 0.15 and Linux) Catting the output file show indeed that the PATH used is the one from the env, not the one from the --action_env :( Do that with protobuf and you get to recompile protobuf everytime you open a new window with a changing environment. |
Now that --incompatible_strict_action_env has been flipped, this has become a more widespread problem, and notably impacts bootstrapping bazel if LD_LIBRARY_PATH or similar is required. |
This has now become a blocking issue for us too. We make extensive use of This doesn't seem like it would be a hard fix for somebody familiar with the codebase? |
There is a workaround: |
As proposed by @ulfjack at #6473 (comment), I think we should add |
I believe I'm running into this in relation to #7899 on macOS. The default path that bazel uses does not find my installation of python3 (macports, I currently have a 'workaround' with |
What is the status of adding |
I currently experienced something very similar in TensorFlow. But there it was due to use of |
This PR adds `--host_action_env` option to specify a set of environment variables to be added to the host configuration. The variables specified by this option are only added to host configuration while those specified by `--action_env` are only included in the target configuration. Fixes: bazelbuild#4008 Closes bazelbuild#12122. PiperOrigin-RevId: 333060884
Description of the problem:
Variables set by
--action_env
are not forwarded throughtools
dependency of a rule. To generate test example, paste following lines into terminal:outputs
however depending on what is uncommented, i.e.,
":rule1",
,":rule2",
,":rule3",
,":rule4",
,":tool",
at the end of BUILD, bazel may output alsorule1
givesRULE1:TESTVAR=hello
- rule1 is directly referencedrule2
andrule3
givesRULE1:TESTVAR=
- rule1 is referenced via tools optionrule4
andtool
again givesRULE1:TESTVAR=hello
- rule1 is referenced via middlemanIf the
rule1
is referenced from the "tool" and from another rule as a dependency, it may be randomly executed with different environment set for each run. Is this the expected behaviour?A consistent behaviour is obtained when exporting the environment variable into bazel environment, i.e.,
NOTE: in case there is a linking error, execute the last command (
bazel build ...
) once more.NOTE2: if more than one rule dependency is uncommented, it may randomly output both results, execute multiple times to verify, e.g.,
Environment info
Operating System: macOS, Linux
Bazel version: release 0.7.0, release 0.5.4
The text was updated successfully, but these errors were encountered: