-
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
[request] robust way to specify LD_LIBRARY_PATH for java/javac #12978
Comments
Another a bit involved case is https://github.com/bazelbuild/rules_nodejs/blob/stable/internal/providers/node_runtime_deps_info.bzl#L148 - here a rule does some |
One more thing that can negate fix attempts is that rules can disable sandboxing (I'd say an .bazelrc option to enforce sandboxing can be useful) via |
There's an implicit fallback from sandboxed to local that since recently can be controlled with the Workers without |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
Description of the problem / feature request:
Bazel builds aren't fully hermetic in many cases
#!/usr/bin/env bash
+ common utilitiesBut on the other hand bazel tries to cleanup environment variables and sandbox actions, which in turn may break non-hermetic cases, not always with an easy fix.
--action_env
may not work for rules withoutuse_default_shell_env=True
including some built-in rules (like DumpPlatformClassPathbazel/tools/jdk/default_java_toolchain.bzl
Line 222 in 667ae2a
--repo_env
seems to cover repo rules--run_under
doesn't seem to work for build or repo rules (could try--run_under='env PATH=.. LD_LIBRARY_PATH=..'
)--sandbox_add_mount_pair
refuses to create paths, only overrides existing.bazelrc
, also need to patch bzl code in the project)--experimental_sandboxfs_path
may be an option, but may not cover repository rules(?) and requires patching sandboxfsAs an initial crude fix, maybe being able to non-conditionally set/extend PATH&LD_LIBRARY_PATH for rules&actions would work.
Feature requests: what underlying problem are you trying to solve with this feature?
Be able to build bazel projects (on NixOS) without a lot of patching bazel or doing brittle host (or container) setup.
Starting with semi-hermetic solutions like
--action_env
sounds ok for a start*PATH=/nix/store/looonghash-smth/{bin,lib}
is actually safe to cache and should be reproducible, assuming other bits areIdeally of course it would be nice to be able to specify all dependencies explicitly, at least in built-in and core rules. If not as build targets/bazel dependencies, then at least like a
./configure
step with ability to always easily specify custom paths.What operating system are you running Bazel on?
NixOS
What's the output of
bazel info release
?3.3.1, but should apply to 4.0.0 too
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.NixOS packages
Have you found anything relevant by searching the web?
NixPkgs already have few patches to bazel code like
/usr/bin/env something
withnix path of something
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix#L324
There's a
buildFHSUserEnv
helper in NixPkgs to create FHS sandboxes/containers https://nixos.org/manual/nixpkgs/stable/#sec-fhs-environments .buildFHSUserEnv
+..._env=PATH=...
+..._env=LD_LIBRARY_PATH=...
may be used to make most of rules work in NixOS, but FHS environment feels like an overkillThe text was updated successfully, but these errors were encountered: