CcToolchainInfo

Information about the C++ compiler being used.

ar_executable

string CcToolchainInfo.ar_executable()

Path to GNU binutils 'ar' binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will be removed soon as part of the new Starlark API to the C++ toolchain.

built_in_include_directories

list CcToolchainInfo.built_in_include_directories

Returns the list of built-in directories of the compiler.

compiler

string CcToolchainInfo.compiler

C++ compiler. May return None.

compiler_executable

string CcToolchainInfo.compiler_executable()

Path to C/C++ compiler binary. WARNING: This method is only added to allow incremental migration of existing users. Please do not use in new code. Will beremoved soon as part of the new Starlark API to the C++ toolchain.

cpu

string CcToolchainInfo.cpu

Target CPU of the C++ toolchain. May return None.

ld_executable

string CcToolchainInfo.ld_executable()

Path to the linker binary. WARNING: This method is only added to allow incrementalmigration of existing users. Please do not use in new code. Will be removed soonas part of the new Starlark API to the C++ toolchain.

libc

string CcToolchainInfo.libc

libc version string. May return None.

needs_pic_for_dynamic_libraries

bool CcToolchainInfo.needs_pic_for_dynamic_libraries(feature_configuration)

Returns true if this rule's compilations should apply -fPIC, false otherwise. Determines if we should apply -fPIC for this rule's C++ compilations depending on the C++ toolchain and presence of `--force_pic` Bazel option.

Parameters

Parameter Description
feature_configuration

FeatureConfiguration

Feature configuration to be queried.

nm_executable

string CcToolchainInfo.nm_executable()

Path to GNU binutils 'nm' binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will be removed soon as part of the new Starlark API to the C++ toolchain.

objcopy_executable

string CcToolchainInfo.objcopy_executable()

Path to GNU binutils 'objcopy' binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will beremoved soon as part of the new Starlark API to the C++ toolchain.

objdump_executable

string CcToolchainInfo.objdump_executable()

Path to GNU binutils 'objdump' binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will be removed soon as part of the new Starlark API to the C++ toolchain.

preprocessor_executable

string CcToolchainInfo.preprocessor_executable()

Path to C/C++ preprocessor binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will be removed soon as part of the new Starlark API to the C++ toolchain.

strip_executable

string CcToolchainInfo.strip_executable()

Path to GNU binutils 'strip' binary. WARNING: This method is only added to allowincremental migration of existing users. Please do not use in new code. Will be removed soon as part of the new Starlark API to the C++ toolchain.

sysroot

string CcToolchainInfo.sysroot

Returns the sysroot to be used. If the toolchain compiler does not support different sysroots, or the sysroot is the same as the default sysroot, then this method returns None. May return None.

target_gnu_system_name

string CcToolchainInfo.target_gnu_system_name

The GNU System Name. May return None.

to_json

string CcToolchainInfo.to_json()

Creates a JSON string from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs, a list of these types or a dictionary with string keys and values of these types. Quotes and new lines in strings are escaped. Examples:
struct(key=123).to_json()
# {"key":123}

struct(key=True).to_json()
# {"key":true}

struct(key=[1, 2, 3]).to_json()
# {"key":[1,2,3]}

struct(key='text').to_json()
# {"key":"text"}

struct(key=struct(inner_key='text')).to_json()
# {"key":{"inner_key":"text"}}

struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_json()
# {"key":[{"inner_key":1},{"inner_key":2}]}

struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_json()
# {"key":{"inner_key":{"inner_inner_key":"text"}}}

to_proto

string CcToolchainInfo.to_proto()

Creates a text message from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs or a list of these types. Quotes and new lines in strings are escaped. Keys are iterated in the sorted order. Examples:
struct(key=123).to_proto()
# key: 123

struct(key=True).to_proto()
# key: true

struct(key=[1, 2, 3]).to_proto()
# key: 1
# key: 2
# key: 3

struct(key='text').to_proto()
# key: "text"

struct(key=struct(inner_key='text')).to_proto()
# key {
#   inner_key: "text"
# }

struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_proto()
# key {
#   inner_key: 1
# }
# key {
#   inner_key: 2
# }

struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_proto()
# key {
#    inner_key {
#     inner_inner_key: "text"
#   }
# }

use_pic_for_dynamic_libraries

bool CcToolchainInfo.use_pic_for_dynamic_libraries

Deprecated. This API is deprecated and will be removed soon. Please do not depend on it. It is disabled with --incompatible_require_feature_configuration_for_pic. Use this flag to verify your code is compatible with its imminent removal.
Deprecated (see https://github.com/bazelbuild/bazel/issues/7007).

Returns true if this rule's compilations should apply -fPIC, false otherwise. Determines if we should apply -fPIC for this rule's C++ compilations.