[PATCH] D109873: Add use_default_shell_env = True to ctx.actions.run

Alexander Grund via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 01:57:28 PDT 2021


Flamefire added a comment.

> AFAICT if you set --action_env=LD_LIBRARY_PATH and --host_action_env=LD_LIBRARY_PATH then actions (in target and host configuration, respectively) *should* have the LD_LIBRARY_PATH in their env.

jax builds with --distinct_host_configuration=false which means all action_env should also be passed to host_action_env. We also pass e.g. --action_env=PYTHONPATH for our builds.
Yet as you can see in https://github.com/google/jax/issues/7842 the env is literally empty. So I'm pretty sure the --host_action_env=LD_LIBRARY_PATH won't work.
Furthermore we can't really use Bazel 4.2 as the underlying TensorFlow isn't compatible with Bazel 4.x yet: https://github.com/tensorflow/tensorflow/blob/v2.6.0/configure.py#L53

> I'm actually not sure in that case what the default_shell_env *does* contain and what shell env the action gets if not the default one. None, I guess? So still some confusion there.

Yeah, very much looks like None while as far as I can tell stuff like LD_LIBRARY_PATH and action_envs are passed if use_default_shell_env is set. The TF guys accepted my PR which adds this to the TF repo, so I guess even they don't know a better way.

Re --incompatible_strict_action_env I found https://github.com/bazelbuild/bazel/issues/6648 that mentions that --action_env *should* be passed, but clearly is not -.-
However if you search the Bazel repo that whole thing is a mess:

See https://github.com/bazelbuild/bazel/issues/3320, https://github.com/bazelbuild/bazel/issues/12059, https://github.com/bazelbuild/bazel/issues/11163 to name a few general ones
https://github.com/bazelbuild/bazel/issues/3057:

> Bazel does not forward --action_env=NAME, but it does forward --action_env=NAME=VALUE.

What??? As this is a repository rule I tried `--action_env=LD_LIBRARY_PATH=$LD_LIBRARY_PATH` but still nothing passed

https://github.com/bazelbuild/bazel/issues/6392:

> Are you sure that params passed to --action_env are passed to repository execute calls? That sounds completely wrong.

I can't follow that reasoning -.-

So in conclusion: I don't see any other option but this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109873/new/

https://reviews.llvm.org/D109873



More information about the llvm-commits mailing list