Skip to main content

Rules

cc_binary

View rule sourceopen_in_new

Arguments

cc_import

View rule sourceopen_in_new

Arguments

cc_library

View rule sourceopen_in_new

Arguments

cc_shared_library

View rule sourceopen_in_new

Arguments

cc_static_library

View rule sourceopen_in_new
This rule is currently experimental and can only be used with the --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, the cc_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_library action and enabling it with the symbol_check feature. 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_check feature add archiver flags that cause the action creating the static library to fail on duplicate symbols.

Arguments

cc_toolchain_suite

View rule sourceopen_in_new
Deprecated: the rule is a no-op and will be removed.

Arguments