docs/versions/6.0.0/rules/lib/CcToolchainInfo.mdx
Information about the C++ compiler being used.
<h2>Members</h2> <ul> <li> <a href="#all_files">all_files</a> </li> <li> <a href="#ar_executable">ar_executable</a> </li> <li> <a href="#built_in_include_directories">built_in_include_directories</a> </li> <li> <a href="#compiler">compiler</a> </li> <li> <a href="#compiler_executable">compiler_executable</a> </li> <li> <a href="#cpu">cpu</a> </li> <li> <a href="#dynamic_runtime_lib">dynamic_runtime_lib</a> </li> <li> <a href="#gcov_executable">gcov_executable</a> </li> <li> <a href="#ld_executable">ld_executable</a> </li> <li> <a href="#libc">libc</a> </li> <li> <a href="#needs_pic_for_dynamic_libraries">needs_pic_for_dynamic_libraries</a> </li> <li> <a href="#nm_executable">nm_executable</a> </li> <li> <a href="#objcopy_executable">objcopy_executable</a> </li> <li> <a href="#objdump_executable">objdump_executable</a> </li> <li> <a href="#preprocessor_executable">preprocessor_executable</a> </li> <li> <a href="#static_runtime_lib">static_runtime_lib</a> </li> <li> <a href="#strip_executable">strip_executable</a> </li> <li> <a href="#sysroot">sysroot</a> </li> <li> <a href="#target_gnu_system_name">target_gnu_system_name</a> </li> <li> <a href="#to_json">to_json</a> </li> <li> <a href="#to_proto">to_proto</a> </li> </ul> <h2 id="all_files">all_files</h2>
<p><pre class="rule-signature"><a class="anchor" href="depset.html">depset</a> CcToolchainInfo.all_files</pre></p>
Returns all toolchain files (so they can be passed to actions using this toolchain as inputs).
<h2 id="ar_executable">ar_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.ar_executable</pre></p>
The path to the ar binary.
<h2 id="built_in_include_directories">built_in_include_directories</h2>
<p><pre class="rule-signature"><a class="anchor" href="list.html">list</a> CcToolchainInfo.built_in_include_directories</pre></p>
Returns the list of built-in directories of the compiler.
<h2 id="compiler">compiler</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.compiler</pre></p>
C++ compiler.
May return <code>None</code>.
<h2 id="compiler_executable">compiler_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.compiler_executable</pre></p>
The path to the compiler binary.
<h2 id="cpu">cpu</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.cpu</pre></p>
Target CPU of the C++ toolchain.
May return <code>None</code>.
<h2 id="dynamic_runtime_lib">dynamic_runtime_lib</h2>
<p><pre class="rule-signature"><a class="anchor" href="depset.html">depset</a> CcToolchainInfo.dynamic_runtime_lib(feature_configuration)</pre></p>
Returns the files from `dynamic_runtime_lib` attribute (so they can be passed to actions using this toolchain as inputs). The caller can check whether the feature_configuration enables `static_link_cpp_runtimes` feature (if not, neither `static_runtime_lib` nor `dynamic_runtime_lib` have to be used), and use `static_runtime_lib` if static linking mode is active.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="dynamic_runtime_lib.feature_configuration">
<code>feature_configuration</code>
</td>
<td>
required
Feature configuration to be queried.
</td>
</tr>
</tbody>
</table>
<h2 id="gcov_executable">gcov_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.gcov_executable</pre></p>
The path to the gcov binary.
<h2 id="ld_executable">ld_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.ld_executable</pre></p>
The path to the ld binary.
<h2 id="libc">libc</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.libc</pre></p>
libc version string.
May return <code>None</code>.
<h2 id="needs_pic_for_dynamic_libraries">needs_pic_for_dynamic_libraries</h2>
<p><pre class="rule-signature"><a class="anchor" href="bool.html">bool</a> CcToolchainInfo.needs_pic_for_dynamic_libraries(feature_configuration)</pre></p>
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.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="needs_pic_for_dynamic_libraries.feature_configuration">
<code>feature_configuration</code>
</td>
<td>
required
Feature configuration to be queried.
</td>
</tr>
</tbody>
</table>
<h2 id="nm_executable">nm_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.nm_executable</pre></p>
The path to the nm binary.
<h2 id="objcopy_executable">objcopy_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.objcopy_executable</pre></p>
The path to the objcopy binary.
<h2 id="objdump_executable">objdump_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.objdump_executable</pre></p>
The path to the objdump binary.
<h2 id="preprocessor_executable">preprocessor_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.preprocessor_executable</pre></p>
The path to the preprocessor binary.
<h2 id="static_runtime_lib">static_runtime_lib</h2>
<p><pre class="rule-signature"><a class="anchor" href="depset.html">depset</a> CcToolchainInfo.static_runtime_lib(feature_configuration)</pre></p>
Returns the files from `static_runtime_lib` attribute (so they can be passed to actions using this toolchain as inputs). The caller should check whether the feature_configuration enables `static_link_cpp_runtimes` feature (if not, neither `static_runtime_lib` nor `dynamic_runtime_lib` should be used), and use `dynamic_runtime_lib` if dynamic linking mode is active.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="static_runtime_lib.feature_configuration">
<code>feature_configuration</code>
</td>
<td>
required
Feature configuration to be queried.
</td>
</tr>
</tbody>
</table>
<h2 id="strip_executable">strip_executable</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.strip_executable</pre></p>
The path to the strip binary.
<h2 id="sysroot">sysroot</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.sysroot</pre></p>
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 <code>None</code>.
May return <code>None</code>.
<h2 id="target_gnu_system_name">target_gnu_system_name</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.target_gnu_system_name</pre></p>
The GNU System Name.
May return <code>None</code>.
<h2 id="to_json">to_json</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.to_json()</pre></p>
<b>Deprecated</b>. This API is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>---incompatible_struct_has_no_methods</code>. Use this flag to verify your code is compatible with its imminent removal.
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:
<pre class=language-python>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"}}} </pre>.<p>Deprecated: instead, use json.encode(x) or json.encode_indent(x), which work for values other than structs and do not pollute the struct field namespace. <h2 id="to_proto">to_proto</h2>
<p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> CcToolchainInfo.to_proto()</pre></p>
<b>Deprecated</b>. This API is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>---incompatible_struct_has_no_methods</code>. Use this flag to verify your code is compatible with its imminent removal.
Creates a text message from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs or dicts or lists of these types. Quotes and new lines in strings are escaped. Struct keys are iterated in the sorted order. Examples:
<pre class=language-python>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" # } # } struct(foo={4: 3, 2: 1}).to_proto() # foo: { # key: 4 # value: 3 # } # foo: { # key: 2 # value: 1 # } </pre><p>Deprecated: use proto.encode_text(x) instead. </body> </html> <!-- {% endraw %} -->