[fuchsia_clang] Fix C++ remote builds (mostly)

This CL fixes several issues in the @fuchsia_clang repository rule thaT
prevented remote C++ compiler and link commands from working.

- Re-implement the 'dependency_file' C++ toolchain feature to use
  -MMD instead of -MD, which uses relative file paths for .d files.
  See [1] for explanations why these are necessary for remote builds.

- Define specific filegroups for libc++ headers and runtime librarieS
  to ensure they are exported to the remote builder properly. In
  particular libcxx-headers-$cpu now includes the __config_site
  header that was previously missing.

- Make cc-prebuilt-binaries smaller, and add link-prebuilt-binaries
  to send less binaries to the sandbox for remote C++ compile and
  link operations.

For testing, use:

```
fx bazel build --config=remote //build/bazel/examples/hello_world:*
```
Alas, debug symbol extraction still fails on remote builders to the missing
'file' command that elf_strip.sh relies on, but this is tracked by a different
issue (fxbug.dev/99458) and will be handled differently.

[1] https://cs.opensource.google/fuchsia/fuchsia/+/main:build/bazel/toolchains/clang/toolchains.bzl;drc=3661d0286c84293b12b04c16894a216e4f4cff0b;l=42

Fixed: 116108

Change-Id: I0f8e3b307ddf9486ba5eb48b6ef4f345def96885
Reviewed-on: https://fuchsia-review.googlesource.com/c/sdk-integration/+/786962
Commit-Queue: Shai Barack <shayba@google.com>
Reviewed-by: Shai Barack <shayba@google.com>
Reviewed-by: Chase Latta <chaselatta@google.com>
Reviewed-by: Renato Mangini Dias <mangini@google.com>
2 files changed
tree: 78e65b0924f2323aac1ce819700a724d3c1eda6c
  1. bazel_rules_fuchsia/
  2. bazel_rules_fuchsia_experimental/
  3. manifests/
  4. scripts/
  5. tests/
  6. .gitignore
  7. AUTHORS
  8. BUILD.bazel
  9. CONTRIBUTING.md
  10. LICENSE
  11. PATENTS
  12. README.md
  13. using_local_sdk.md
README.md

Fuchsia SDK Integration Repository

This repository provides environment-specific (e.g. Bazel, GN) tools for the SDK and associated integration tests in a public repo.

Visit Contributing to Fuchsia to learn how to contribute to this repository.