-
Notifications
You must be signed in to change notification settings - Fork 40
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
FR: SYSROOT generated by rules_distroless for hermetic CC complation #124
Comments
This is a very cool idea |
This is awesome!! I was wondering about something like this as well! TIL about bazel-contrib/toolchains_llvm's Having something like this API would be amazing, I had to hack something together for a project I'm working on. Basically a custom Docker image from where I then create toolchains using bazelbuild/bazel-toolchains and I was going to eventually try something like this but much less nice, just create the image with This is neat and I'd love to have it! Hopefully other Cxx toolchains and other rules support something like this |
So just thinking about this one a bit more, and with the caveat that I’m way out of my depth - could we figure out a way to make bazel invoke actions under a root thats completely controlled by rules_distroless? This would be (very close to) the holy grail for making sure you fully understand your environment, and for making sure that your builds tests and production runtime are deeply aligned… |
Context here is that this repo has been exceptionally helpful for us uplifting our containers across the board (thank you!), but we still have the horrible situation where test environments (ie remote build base containers) contain, say, grep, but our production runtime doesn’t - and grep is required by bazel’s java_binary wrapper script. Sadness ensues. |
I was inspired by the idea of this FR and started hacking in https://github.com/lukasoyen/bazel_debian_packages/tree/apt-sysroot. But then I realized this might contradict the stated goal of the repository, so I decided to fork If you see it within scope of |
Sure, please make a PR so we can discuss there. |
👋 I'd love to see this too -- I independently came to a similar conclusion as y'all last week, and would be happy to collaborate on this. What I have so far is a bunch of targets for assembling the sysroots externally of where they would actually be used; more befitting of an standalone example, or an example of how code might be generated more than anything else. |
While working on a GLIBC related problem, i realized that rules_distroless could have made hermetic cc compilation so much easier by generating a sysroot out of the debian packages that are being fetched.
This is great for one single reason, what's actually going into the container is also what you are linking against!
I can imagine a bzlmod only API, as such
The text was updated successfully, but these errors were encountered: