Skip to content

Commit f4b5d59

Browse files
FlamefireGMNGeoffrey
authored andcommitted
Add use_default_shell_env = True to ctx.actions.run
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
1 parent 6e994a8 commit f4b5d59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

utils/bazel/llvm-project-overlay/mlir/tblgen.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def _gentbl_rule_impl(ctx):
169169
inputs = trans_srcs,
170170
executable = ctx.executable.tblgen,
171171
arguments = [args],
172+
# Make sure action_env settings are honored so the env is the same as
173+
# when the tool was built. Important for locating shared libraries with
174+
# a custom LD_LIBRARY_PATH.
175+
use_default_shell_env = True,
172176
mnemonic = "TdGenerate",
173177
)
174178

0 commit comments

Comments
 (0)