-
Notifications
You must be signed in to change notification settings - Fork 74.3k
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
Add use_default_shell_env = True to all ctx.actions.run_shell rules #44549
Add use_default_shell_env = True to all ctx.actions.run_shell rules #44549
Conversation
c53eff5
to
03fc39e
Compare
For some reason I was also seeing the environment dropped from a |
03fc39e
to
f0e9a20
Compare
@buchgr, would you mind to take a look at this change? I fear it might not play nice with RBE. |
@buchgr confirmed that this prevent RBE caching between different users, and would cause problems when the host's Is there any chance you could ldconfig to work around this in your environment? |
@Flamefire Can you please check @chsigg's comments and keep us posted ? Thanks! |
@gbaned If you are referring to
No, this is not possible. Usual HPC environments have multiple versions of a software installed and decide via environment variables which is active (in particular LD_LIBRARY_PATH and PATH for binaries, CPATH & LIBRARY_PATH for dependencies) I'm unsure why this is now a problem to add this as e.g. Unfortunately I don't understand enough about Bazel and especially RBE but for us sysadmins it is a real pain that the environment gets cleared on multiple levels |
@chsigg Can you please take a look on above comments from @Flamefire. Thanks! |
Another idea, would --action_env or --host_action_env maybe do what you need? |
@chsigg No this does not work. This came up in a recent Bazel issue (bazelbuild/bazel#12579 (comment)) where it was observed that action_env and such are seemingly not passed when |
@Flamefire Can you please resolve conflicts? Thanks! |
To be honest, I don't know how we can resolve this. @buchgr, do you have any suggestions? There is a need to properly pass environment variables to build actions, but bazel sometimes drops them (due to bugs, IIUC). The change here would work around those bugs, but it doesn't play well with RBE. |
IIUC the In the case of Anyway, 3 strong arguments in favor of this change:
|
@Flamefire Can you please resolve conflicts? Thanks! |
To compile flatbuffers definition Bazel starts the flatbuffers compiler flatc which is potentially built using a custom toolchain and hence requires a set up LD_LIBRARY_PATH. Ommitting the `use_default_shell_env` (defaulting to false) clears the whole environment and the binary may try to use older system libs such as /lib64/libstdc++.so causing it to fail in case it is (much) older than the used libstdc++ from the custom toolchain which is very common in HPC environments. Hence I added `use_default_shell_env = True` as already done in e.g. `_local_genrule_impl`.
@gbaned Rebased |
8aed0d6
to
7268be5
Compare
Had to close+reopen due to Github not detecting the change... |
When building a tool in a non-standard environment (e.g. custom compiler path -> LD_LIBRARY_PATH set) then `use_default_shell_env = True` is required to run that tool in the same environment or otherwise the build will fail due to missing symbols. See jax-ml/jax#7842 for this issue and tensorflow/tensorflow#44549 for related fix in TF
When building a tool in a non-standard environment (e.g. custom compiler path -> LD_LIBRARY_PATH set) then `use_default_shell_env = True` is required to run that tool in the same environment or otherwise the build will fail due to missing symbols. See jax-ml/jax#7842 for this issue and tensorflow/tensorflow#44549 for related fix in TF. Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D109873
PiperOrigin-RevId: 394106593 Change-Id: I2226f80fd3bef5e04a42174a8a519f612ae39985
…_without_soft_link Merge pull request tensorflow#44549 from Flamefire:add_default_shell_env
To start subprograms, even simple bash snippets, Bazel uses an
executable
process-wrapper
which is potentially built using a customtoolchain and hence requires a set up LD_LIBRARY_PATH.
Ommitting the
use_default_shell_env
(defaulting to false) clears thewhole environment and the binary may try to use older system libs such
as /lib64/libstdc++.so causing it to fail in case it is (much) older
than the used libstdc++ from the custom toolchain which is very common
in HPC environments.
Hence I added
use_default_shell_env = True
as already done in e.g._local_genrule_impl
.