Lines Matching +full:- +full:- +full:toolchains
1 .. _seed-0113:
10 :proposal_date: 2023-09-28
15 -------
17 -------
18 This SEED proposes custom Starlark rules for declaring C/C++ toolchains in
22 ----------
24 ----------
30 - **Underdocumented patterns**: The
39 - **Not inherently modular**: Bazel expects the overwhelming majority of a
45 …creating a C/C++ toolchain <https://bazel.build/tutorials/ccp-toolchain-config#configure-cc-toolch…
46 illustrates expanding out the toolchain definition as a no-argument Starlark
49 As Pigweed fully embraces multi-platform builds, it is critical for both
51 definitions that work for the relevant hardware project-specific code/libraries.
57 --------
59 --------
60 1. Introduce rules for defining C/C++ toolchains
63 will introduce new Bazel rules that allow toolchains to share common boilerplate
64 without hindering power-user functionality.
72 .. code-block::
103 "-Werror",
142 target_system_name = "x86_64-unknown-linux-gnu",
143 toolchain_identifier = "host-toolchain-linux",
159 2. Provide standard toolchain building-blocks
163 and easily assemble toolchains for desktop and embedded targets. This includes,
166 - Rules that define tool sets for common toolchains (LLVM/clang, GNU/gcc).
167 - Fully specified, modular
168 `features <https://bazel.build/docs/cc-toolchain-config-reference#features>`_.
169 - Common flag sets that users may want to apply directly to their toolchains.
171 - Platform/architecture support rules, including host OS SDK integrations
172 (Xcode, Windows SDK) and architecture-specific flag sets.
176 toolchains.
178 ---------------------
180 ---------------------
190 toolchains in ways that gave downstream projects sufficient control over the
199 without OS-specific considerations.
208 - These rules intended to be modular, but in practice were relatively tightly
210 - Transitive dependencies throughout the toolchain definition process resulted
211 in some hard-to-debug issues (see
219 truly modular toolchain rules. The proposed direction is much more in-line
224 toolchains, but diverges significantly from the underlying Bazel C/C++
225 toolchain building-blocks. If this work was already complete and
226 well-established, it probably would have satisfied some of Pigweed's key needs.
231 scalable approach at toolchains. This repository strives to be an all-in-one
232 repository for embedded toolchains, and does a very good job at providing
233 scalable models for establishing toolchains. This repository is relatively
235 and easily standing up custom toolchains. Instead, it's more suited towards
236 contributing new one-size-fits-all toolchains to ``crt`` directly.
240 Android's Bazel-based build has invested heavily in toolchains, but they're
242 …ild/bazel/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl;l=375-389;drc=097d710c349758fc…
243 These toolchains scale for the purpose of Android, but unfortunately are
246 Due to the sheer amount of investment in these toolchains, though, they serve
251 As part of an exploratory phase of getting toolchains set up for Linux and
253 `an initial prototype <https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/157634>`_
254 for modular Bazel toolchains was drafted and deployed to Pigweed. This work
260 .. code-block::
262 …urce.google/pigweed/pigweed/+/main:pw_toolchain/host_clang/BUILD.bazel;l=113-143;drc=7df1768d915fe…
269 ar = "@llvm_toolchain//:bin/llvm-ar",
271 # TODO: b/305737273 - Globbing all files for every action has a
285 gcov = "@llvm_toolchain//:bin/llvm-cov",
290 strip = "@llvm_toolchain//:bin/llvm-strip",
296 toolchain_identifier = "host-toolchain-linux",
299 …e.google/pigweed/pigweed/+/main:pw_toolchain_bazel/features/BUILD.bazel;l=21-34;drc=f96fd31675d136…
305 linkopts = ["-nostdlib++"],
314 "-no-canonical-prefixes",
326 the rule used to declare toolchains
327 (`relevant change <https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168614/17/pw_toolcha…
333 ---------------
335 ---------------
339 `here <https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168351/1>`_,
340 and retains API compatibility with the initial prototype as a proof-of-concept.
349 -------------------------------------
354 a clear path for migrating existing toolchains piece-by-piece (which may be
363 ----------------------------------------
366 This allows this work to be used for non-embedded projects, and reduces the
381 .. code-block::
389 "-Werror",
401 # A flag_set that relies on a non-trivial or non-constant expression of
418 - ``flags`` (added): Express a constant, trivial list of flags. If this is
427 - ``expand_if_true``\, ``expand_if_false``\, ``expand_if_equal``\: More complex
430 to express the intent). See :ref:`pw_cc_flag_set-exceptions` below for an
435 --------------------
445 globally-applied warnings, global defines, and other similar flags should be
447 (see :ref:`pw_cc_toolchain-toolchain-declarations` for more information). Each
452 .. _application-of-flags-feature-flags:
458 `official Bazel documentation on features <https://bazel.build/docs/cc-toolchain-config-reference#f…
472 :ref:`as illustrated below <pw_cc_flag_set-exceptions>`).
490 .. _pw_cc_flag_set-exceptions:
493 ----------
504 .. code-block::
508 # TODO: b/297413805 - Remove this implementation.
549 .. code-block::
576 :ref:`application of feature flags <application-of-flags-feature-flags>`.
578 .. code-block::
604 .. code-block::
628 .. _pw_cc_toolchain-toolchain-declarations:
636 - **action_config_flag_sets**: Flag sets to apply to action configs. Since flag
639 - **additional_files**: Now that tools can spec out required files, those
644 .. code-block::
672 toolchain_identifier = "host-toolchain-linux",
674 "%package(@llvm_toolchain//)%/include/x86_64-unknown-linux-gnu/c++/v1",
678 "%sysroot%/usr/include/x86_64-linux-gnu",
683 ------------
685 ------------
688 Improving Bazel's native rules for defining C/C++ toolchains is out of the
694 ----------
696 ----------
699 Pigweed's Rust toolchains have some interoperability concerns and requirements.
719 cross-reference it against the output of
720 `--experimental_save_feature_state <https://bazel.build/reference/command-line-reference#flag--expe…