Skip to content

Use default env on rustc compile actions to allow bash scripts for linker #3556

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aaliddell
Copy link

See #3482 for context.

I accept that this may not be merged as-is, as using use_default_shell_env opens the sandbox to other env vars affecting caching etc. However, getting PATH into the sandbox another way requires a bit more discussion, which I hope we can have here and I can amend PR.

Possible alternatives:

  • The default env coming from ctx.configuration.default_shell_env is empty, so that's no use
  • The upstream rules_cc could set the appropriate env var on the toolchain, which is then inherited by cc_common.get_environment_variables() for the linker
  • Revert bazelbuild/rules_cc@d749150 and address the path search in the 'Bazel' way that doesn't require PATH i.e use repository_ctx.which(bash) to embed the correct absolute path to bash into cc_wrapper.sh, then no changes are required here potentially

…nker

The default env has no PATH available, which causes compilation
failures on MacOS where the linker from rules_cc toolchain is a
wrapper bash script with a '/usr/bin/env bash' shebang, which
hence cannot find bash

See bazelbuild#3482
@aaliddell
Copy link
Author

I missed the discussion in #3535 (searched issues but not PRs 🤦‍♂️); close this if you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant