-
Notifications
You must be signed in to change notification settings - Fork 75
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
Define a distribution constraint setting #5
Comments
@aiuto for reference (who else should be reading these?) What's the practical difference of the different distributions? Can it be boiled down to the paths where the tools end up? I wonder if the |
That proposal looks relevant. But I'm struggling to visualize how it will work in this case. To summarize:
So what should that |
I'd like to think the right path forward would involve enhancing rule sets' toolchain definitions to auto-configure as necessary. The theoretical But I understand Another example is Versioned Runtime APIs under |
Those are hard questions. The easy question is "does this idea make sense", to which the answer is yes. I think. My understanding of your proposal is basically
The cross product of the 3 things gets a configured tool chain with binaries downloaded from a place of the user's choice. Before we can figure out the name, we need to know if we want to talk about specific package managers (SaltStack vs. Chocolatey) or do we talk about my OS distribution (Nix vs RedHat). Or both? Then the question is if this repository is the right place. I think yes if there is going to be common infrastructure for downloading things from different kinds of repositories and the toolchain implementations will share it. Can you come with a proof of concept that demonstrates the kind of thing you want to do? |
My hunch is that it should be only the former. There are two use cases under discussion:
In use case 1, distro-specific differences are either dealt with via auto-configuration or with constraint settings but these should be more granular than just So I guess |
How do we make progress on this front? |
Another ping. |
@gregestren thinking about this more, perhaps a generic Constraint settings still have a role, beyond the question of finding the right path for compilers. Because sometimes a specific tool (like the package manager) has to be called to populate a global content addressable store and have paths to point to. But if you agree with the first paragraph above, we can close this issue. |
@mboes I'm trying to get back on track with these themes. Please give me some more time to think through your points more thoroughly before I can offer a reasonable response. This is up-prioritized in my queue. |
A common trick with Bazel rules is to download prebuilt SDK's and use that as toolchains. However, it is a mistake to assume that keying which SDK to download on the
@bazel_tools//platforms:os
value will work in every case. SDK's are seldom self-contained and often assume a specific glibc, or filesystem layout. On Linux, not all distributions are alike. On macOS, not all versions are alike. So we need finer grained platform info.One idea would be to add a generic
distribution
constraint setting, in addition to the existingos
andcpu
constraint settings. Thedistribution
setting could be used to choose the SDK format as well. For example, while the default might be a binary distribution as commonly distributed by upstream (official Go SDK's, official GHC binary distributions, etc), alternatives for obtaining a working toolchain might be to use Snappy, AppImage, Nix or Flatpak, depending on what is available or what the user prefers.Not all toolchain distribution methods work on all platforms. Binary distributions seldom work on NixOS because the dynamic linker is not at a known location. Conversely, using Nix, be it on macOS or Linux, requires first that Nix be installed (same from Snappy etc). One might argue that Flatpak, Nix or Snappy should be an
os
constraint value. But that's very inconvenient. For example, on macOS dynamic libraries are calledlibfoo.dylib
rather thanlibfoo.so
. Rules want to deal with macOS specifics, while also letting the user choose among several possible sources fo toolchains. To allow that with just one constraint setting, we'd have to define many constraint values, likeosx
,osx_nix
,linux
,linux_nix
etc.Nix is available as a distribution method both on Linux and on macOS. Flatpak, Snappy, AppImage and the like are for the moment Linux-specific. But could well likewise be multi-platform in the future. Defining a new
constraint_setting
would avoid the combinatorial explosion in constraint values that would otherwise be needed if we continue having just@bazel_tools//platforms:os
.The text was updated successfully, but these errors were encountered: