Rules
cc_binary
View rule sourceopen_in_newArguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |
additional_linker_inputs | List of labels; default is [] |
conlyopts | List of strings; default is [] |
copts | List of strings; default is [] |
cxxopts | List of strings; default is [] |
defines | List of strings; default is [] |
dynamic_deps | List of labels; default is [] |
hdrs_check | String; default is "" |
includes | List of strings; default is [] |
link_extra_lib | Label; default is "@bazel_tools//tools/cpp:link_extra_lib" |
linkopts | List of strings; default is [] |
linkshared | Boolean; default is False |
linkstatic | Boolean; default is True |
local_defines | List of strings; default is [] |
malloc | Label; default is "@bazel_tools//tools/cpp:malloc" |
nocopts | String; default is "" |
reexport_deps | List of labels; default is [] |
stamp | Integer; default is -1 |
win_def_file | Label; default is None |
cc_import
View rule sourceopen_in_newArguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |
hdrs | List of labels; default is [] |
alwayslink | Boolean; default is False |
includes | List of strings; default is [] |
interface_library | Label; default is None |
linkopts | List of strings; default is [] |
objects | List of labels; default is [] |
pic_objects | List of labels; default is [] |
pic_static_library | Label; default is None |
shared_library | Label; default is None |
static_library | Label; default is None |
system_provided | Boolean; default is False |
cc_library
View rule sourceopen_in_newArguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |
hdrs | List of labels; default is [] |
additional_compiler_inputs | List of labels; default is [] |
additional_linker_inputs | List of labels; default is [] |
alwayslink | Boolean; default is False |
conlyopts | List of strings; default is [] |
copts | List of strings; default is [] |
cxxopts | List of strings; default is [] |
defines | List of strings; default is [] |
hdrs_check | String; default is |
implementation_deps | List of labels; default is [] |
include_prefix | String; default is "" |
includes | List of strings; default is [] |
linkopts | List of strings; default is [] |
linkstamp | Label; default is None |
linkstatic | Boolean; default is False |
local_defines | List of strings; default is [] |
strip_include_prefix | String; default is "" |
textual_hdrs | List of labels; default is [] |
win_def_file | Label; default is None |
cc_shared_library
View rule sourceopen_in_newArguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |
additional_linker_inputs | List of labels; default is [] |
dynamic_deps | List of labels; default is [] |
experimental_disable_topo_sort_do_not_use_remove_before_7_0 | Boolean; default is False |
exports_filter | List of strings; default is [] |
roots | List of labels; default is [] |
shared_lib_name | String; default is "" |
static_deps | List of strings; default is [] |
user_link_flags | List of strings; default is [] |
win_def_file | Label; default is None |
cc_static_library
View rule sourceopen_in_new--experimental_cc_static_library flag.
Produces a static library from a list of targets and their transitive dependencies.
The resulting static library contains the object files of the targets listed in
deps as well as their transitive dependencies, with preference given to
PIC objects.
Output groups
linkdeps
A text file containing the labels of those transitive dependencies of targets listed in
deps that did not contribute any object files to the static library, but do
provide at least one static, dynamic or interface library. The resulting static library
may require these libraries to be available at link time.
linkopts
A text file containing the user-provided linkopts of all transitive
dependencies of targets listed in deps.
Duplicate symbols
By default, thecc_static_library rule checks that the resulting static
library does not contain any duplicate symbols. If it does, the build fails with an error
message that lists the duplicate symbols and the object files containing them.
This check can be disabled per target or per package by setting
features = ["-symbol_check"] or globally via
--features=-symbol_check.
Toolchain support for symbol_check
The auto-configured C++ toolchains shipped with Bazel support the
symbol_check feature on all platforms. Custom toolchains can add support for
it in one of two ways:
- Implementing the
ACTION_NAMES.validate_static_libraryaction and enabling it with thesymbol_checkfeature. The tool set in the action is invoked with two arguments, the static library to check for duplicate symbols and the path of a file that must be created if the check passes. - Having the
symbol_checkfeature add archiver flags that cause the action creating the static library to fail on duplicate symbols.
Arguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |
deps | List of labels; default is [] The list of targets to combine into a static library, including all their transitive dependencies. Dependencies that do not provide any object files are not included in the static library, but their labels are collected in the file provided by the linkdeps output group. |
cc_toolchain_suite
View rule sourceopen_in_newArguments
| Attributes | |
|---|---|
name | Name; required A unique name for this target. |