Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible_use_specific_tool_files: Use appropriate artifacts from cc_toolchain as inputs to C++ actions. #8531

Closed
scentini opened this issue May 31, 2019 · 4 comments
Assignees
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules

Comments

@scentini
Copy link
Contributor

scentini commented May 31, 2019

cc_toolchain has attributes corresponding to various toolchain components like ar_files, compiler_files, and as_files. Previously, Bazel used broad file groups like all_files as inputs for several classes of actions and ignored the more specific toolchain attributes. --incompatible_use_specific_tool_files brings these attributes into use.

Namely, under this flag:

  • C and C++ compilation actions use compiler_files rather than all_files.
  • Static library-generating actions use ar_files rather than linker_files.
  • Non-processed assembler actions use as_files rather than all_files. Preprocessed assembly actions use compiler_files because preprocessing is usually done by the C compiler.

Relevant issues: #6927, #6928.

Migration

For every cc_toolchain rule, ensure

  • compiler_files contains the compiler binary and standard library header files if necessary
  • as_files includes the assembler (e.g., gas)
  • ar_files includes the static archive tool (e.g., ar)

Expected timeline

Disabled by default in 0.27.
Enabled in the September 2019 release.

@scentini
Copy link
Contributor Author

@benjaminp Can you please update this issue with migration details?

bazel-io pushed a commit that referenced this issue May 31, 2019
This option makes
1. C++ compilation actions include only the toolchain's compiler_files artifacts as inputs not all_files.
2. Non-preprocessed assembler actions include only the toolchain's as_files artifacts as inputs not all_files.
3. Archiver link actions include the toolchain's ar_files artifacts as inputs rather than linker_files.

See #8531.

Closes #7725.

PiperOrigin-RevId: 250880419
@benjaminp
Copy link
Collaborator

(I lack permissions to edit the actual issue, but here we go.)

cc_toolchain has attributes corresponding to various toolchain components like ar_files, compiler_files, and as_files. Previously, Bazel used broad file groups like all_files as inputs for several classes of actions and ignored the more specific toolchain attributes. --incompatible_use_specific_tool_files brings these attributes into use.

Namely, under this flag:

  • C and C++ compilation actions use compiler_files rather than all_files.
  • Static library-generating actions use ar_files rather than linker_files.
  • Non-processed assembler actions use as_files rather than all_files. Preprocessed assembly actions use compiler_files because preprocessing is usually done by the C compiler.

Migration

For every cc_toolchain rule, ensure

  • compiler_files contains the compiler binary and standard library header files if necessary
  • as_files includes the assembler (e.g., gas)
  • ar_files includes the static archive tool (e.g., ar)

Expected timeline

Disabled by default in 0.27.
Enabled in the September 2019 release.

@kkiningh
Copy link

kkiningh commented Jun 2, 2019

With this flag enabled I get the following error on OSX 10.14.2 when I try to compile a cc_library.

src/main/tools/process-wrapper-legacy.cc:58: "execvp(external/local_config_cc/wrapped_ar, ...)": No such file or directory

Simple example here.

benjaminp added a commit to benjaminp/bazel that referenced this issue Jun 3, 2019
@scentini scentini added P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules labels Jun 3, 2019
bazel-io pushed a commit that referenced this issue Jun 4, 2019
bazel-io pushed a commit that referenced this issue Jun 6, 2019
…ains where needed.

#8531

RELNOTES: None.
PiperOrigin-RevId: 251796866
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
This option makes
1. C++ compilation actions include only the toolchain's compiler_files artifacts as inputs not all_files.
2. Non-preprocessed assembler actions include only the toolchain's as_files artifacts as inputs not all_files.
3. Archiver link actions include the toolchain's ar_files artifacts as inputs rather than linker_files.

See bazelbuild#8531.

Closes bazelbuild#7725.

PiperOrigin-RevId: 250880419
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
…ains where needed.

bazelbuild#8531

RELNOTES: None.
PiperOrigin-RevId: 251796866
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
This option makes
1. C++ compilation actions include only the toolchain's compiler_files artifacts as inputs not all_files.
2. Non-preprocessed assembler actions include only the toolchain's as_files artifacts as inputs not all_files.
3. Archiver link actions include the toolchain's ar_files artifacts as inputs rather than linker_files.

See bazelbuild#8531.

Closes bazelbuild#7725.

PiperOrigin-RevId: 250880419
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
…ains where needed.

bazelbuild#8531

RELNOTES: None.
PiperOrigin-RevId: 251796866
benjaminp added a commit to benjaminp/bazel that referenced this issue Aug 8, 2019
benjaminp added a commit to benjaminp/bazel that referenced this issue Aug 8, 2019
benjaminp added a commit to benjaminp/bazel that referenced this issue Aug 8, 2019
bazel-io pushed a commit that referenced this issue Aug 13, 2019
See #8531.

Closes #9126.

RELNOTES: The --incompatible_use_specific_tool_files flag has been flipped. See #9126 for more information.
PiperOrigin-RevId: 263120622
@luxe
Copy link

luxe commented Oct 13, 2019

I'm confused why this is enabled now, but the master docs still say ar_files is currently unused (#6928).
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library

philsc added a commit to philsc/ttyrex that referenced this issue Oct 16, 2019
Looks like bazelbuild/bazel#8531 was the
only thing that affected me this time around.
rohansingh added a commit to tidbyt/toolchains that referenced this issue Oct 31, 2019
Bazel 1.0 flips [`--incompatible_use_specific_tool_files`][1]. We now need to
specify all compilation dependencies in `compiler_files`.

[1]: bazelbuild/bazel#8531
tensorflow-copybara pushed a commit to tensorflow/tensorflow that referenced this issue Nov 12, 2019
This will fix Cuda and ROCm RBE build with Bazel 1.0

Related bazelbuild/bazel#8531

Preconfigured toolchains are updated by:

tensorflow/third_party/toolchains/preconfig/generate/update.sh ubuntu16.04-py3-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0

tensorflow/third_party/toolchains/preconfig/generate/update.sh ubuntu16.04-py3-gcc7_manylinux2010-cuda10.0-cudnn7-tensorrt5.1

tensorflow/third_party/toolchains/preconfig/generate/update.sh ubuntu16.04-py3_opt-gcc5-rocm

PiperOrigin-RevId: 279942421
Change-Id: Ic8538d49b970b074e35acebc1345482170d98847
RyRose added a commit to RyRose/smouth-os that referenced this issue Apr 11, 2021
See bazelbuild/bazel#8531 for more details on
what this flag is. I'll need to clean up the cc_toolchain definitions to
appropriately sort the tool files.
rpwoodbu added a commit to rpwoodbu/mosh-chrome that referenced this issue Feb 28, 2022
Had to add `ar_files` and `as_files` to the toolchain rule. See:
bazelbuild/bazel#8531

Tried breaking up the filegroups, but the toolchain is too convoluted to be
worth it. Found out along the way, though, that the "cpp" `tool_path` pointed
to the wrong binary name, so fixed that.
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    See bazelbuild/bazel#8531.

    Closes #9126.

    RELNOTES: The --incompatible_use_specific_tool_files flag has been flipped. See bazelbuild/bazel#9126 for more information.
    PiperOrigin-RevId: 263120622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

No branches or pull requests

6 participants