Skip to content
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 doesn't apply to genrule with host configuration #6473

Closed
meteorcloudy opened this issue Oct 23, 2018 · 3 comments
Closed

--action_env doesn't apply to genrule with host configuration #6473

meteorcloudy opened this issue Oct 23, 2018 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@meteorcloudy
Copy link
Member

meteorcloudy commented Oct 23, 2018

How to reproduce
BUILD:

genrule(
    name = "gen",
    outs = ["hello"],
    cmd = "touch $@",
    tools = [":mytool"],
)

genrule(
    name = "mytool",
    outs = ["tool"],
    cmd = "touch $@",
)

Run bazel build //:gen -s --action_env HAHA=123

pcloudy@pcloudy0-w MSYS ~/workspace/my_tests/genrule_tmp_test
$ bazel build //:gen -s --action_env HAHA=123
INFO: Build options have changed, discarding analysis cache.
INFO: Analysed target //:gen (1 packages loaded).
INFO: Found 1 target...
SUBCOMMAND: # //:mytool [action 'Executing genrule //:mytool [for host]']
cd C:/users/pcloudy/_bazel_pcloudy/j7l3crzt/execroot/__main__
  SET PATH=c:\tools\msys64\usr\bin;c:\tools\msys64\bin;C:\Program Files\CMake\bin;C:\Python36;C:\tools\msys64\home\pcloudy\bin;C:\Program Files\Java\jdk1.8.0_77\bin;C:\tools\msys64\usr\local\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\tools\msys64\usr\bin\site_perl;C:\tools\msys64\usr\bin\vendor_perl;C:\tools\msys64\usr\bin\core_perl
  c:/tools/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; touch bazel-out/host/genfiles/tool
SUBCOMMAND: # //:gen [action 'Executing genrule //:gen']
cd C:/users/pcloudy/_bazel_pcloudy/j7l3crzt/execroot/__main__
  SET HAHA=123
    SET PATH=c:\tools\msys64\usr\bin;c:\tools\msys64\bin;C:\Program Files\CMake\bin;C:\Python36;C:\tools\msys64\home\pcloudy\bin;C:\Program Files\Java\jdk1.8.0_77\bin;C:\tools\msys64\usr\local\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\tools\msys64\usr\bin\site_perl;C:\tools\msys64\usr\bin\vendor_perl;C:\tools\msys64\usr\bin\core_perl
  c:/tools/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; touch bazel-out/x64_windows-fastbuild/genfiles/hello
Target //:gen up-to-date:
  C:/users/pcloudy/_bazel_pcloudy/j7l3crzt/execroot/__main__/bazel-out/x64_windows-fastbuild/genfiles/hello
INFO: Elapsed time: 1.004s, Critical Path: 0.49s
INFO: 2 processes: 2 local.
INFO: Build completed successfully, 3 total actions

This is not a Windows specific issue, also happens on Linux.
Related TensorFlow issue: tensorflow/tensorflow#22395 (comment)

Workaround: add --distinct_host_configuration=false option

@ulfjack
Copy link
Contributor

ulfjack commented Nov 23, 2018

Maybe we should add a --host_action_env flag?

@gertvdijk
Copy link
Contributor

possible dupe of #4008?

@ulfjack
Copy link
Contributor

ulfjack commented Jan 7, 2019

Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

No branches or pull requests

5 participants