-
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
shell toolchain, design: including common bintools #5265
Comments
FYI, I don't plan to work on this for the foreseeable future (in the next few months). |
@laszlocsomor could you add a priority to this issue please? |
Setting priority to P3 for now -- we will probably not see much advancement with this issue before Bazel 1.0, and while it is an important issue, it's not as critical as something like #6351 would be. |
FYI if anyone is actively troubled by this, recently I successfully use rules_nixpkgs to source pinned version of binaries from See this target example for depending on |
FYI @asuffield |
|
Looks like this issue is resolved by rules_sh and the modern toolchain resolution mechanism. |
I think this is still relevant, |
Doesn't rules_sh just define additional make variables via a toolchain that any |
Yeah but that still requires the whole ecosystem to rewrite their genrules to use those make variables. |
The effort wouldn't be specific to the make variables offered by rules_sh, but should apply to any make variable defined by any toolchain. Even if Bazel itself provided a shell toolchain, I think that third-party genrules would still need to support toolchain and the make variables to expose to make use of it. @alexeagle Do the rules_js genrules support toolchains and make variables? Maybe bazel-lib already has helpers for doing that properly and evaluating the make variables? |
Yeah absolutely, but there's things bazel itself can do that toolchains cannot to ease this transition or to support both ways of using it, for example by providing a shell toolchain, but also automatically adding all the locations of the binaries in the toolchain into the Alternatively bazel could provide a remote prebuilt shell toolchain, like it provides a remote jdk, and the user could specify their own or autodetect a locally installed one. This would allow bazel to use a wider range of systems as both its host environment and exec environment (very relevant in remote execution environments, where the exec environment could be a very barebones one), and improve the default hermeticity of bazel builds. |
Is this it? bazel/tools/sh/sh_configure.bzl Line 84 in 4148241
I can see |
Description of the problem / feature request:
Design a mechanism to express that a rule executing a shell command depends on certain command line tools.
Feature requests: what underlying problem are you trying to solve with this feature?
Not every machine has Bash installed, and those that do don't always install Bash at the same location, or have another shell interpreter installed. To accommodate all scenarios, I designed how to turn Bash, or broadly speaking, the Shell, into a toolchain. The efforts is tracked as #4319.
However what Bazel treats as "the shell" is more than just the shell interpreter. Bazel assumes that not only Bash is the shell and it's installed at a fixed location, but also that common GNU binutils and other common programs such as "zip" or "grep" are also installed and are on the PATH.
Rules that execute shell commands also expect these tools to exist and be on the PATH. Bazel currently has no way to express that such rules depend on these tools.
The text was updated successfully, but these errors were encountered: