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_platforms_repo_for_constraints: Don't use constraints from @bazel_tools, use @platforms instead #8622

Closed
hlopko opened this issue Jun 13, 2019 · 34 comments
Assignees
Labels
breaking-change-6.0 Incompatible flags to be flipped in Bazel 6.0 incompatible-change Incompatible/breaking change migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions type: process

Comments

@hlopko
Copy link
Member

hlopko commented Jun 13, 2019

Available since: 0.28
Tracking issue: #6516

Motivation

Bazel currently provides common constraints for platforms and toolchains in @bazel_tools//platforms. We are migrating these out of the Bazel binary to a principled, standalone repository over at https://github.com/bazelbuild/platforms which can be released independently from the Bazel binary and which defines a process for adding more constraints.

Migration

Ideally, declare an explicit dependency on https://github.com/bazelbuild/platforms, name the repository as @platforms, and use constraints from this repository. In cases where you cannot depend on https://github.com/bazelbuild/platforms (please tell us the reason in the comment), you can use the snapshot of https://github.com/bazelbuild/platforms in Bazel - Bazel implicitly provides this repository for Bazel's needs.

The actual migration in BUILD files is simple - use @platforms//setting:value instead of @bazel_tools//platforms:value:

sed 's$@bazel_tools//platforms:(linux|osx|windows|android|freebsd|ios|os)$@platforms//os:\1$' -E -i **/*
sed 's$@bazel_tools//platforms:(cpu|x86_32|x86_64|ppc|arm|aarch64|s390x)$@platforms//cpu:\1$' -i -E **/*
@hlopko hlopko added P1 I'll work on this now. (Assignee required) incompatible-change Incompatible/breaking change bazel 1.0 labels Jun 13, 2019
@hlopko hlopko self-assigned this Jun 13, 2019
hlopko added a commit to hlopko/bazel that referenced this issue Jun 13, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.
bazel-io pushed a commit that referenced this issue Jun 14, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
#8622

Tracking issue:
#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See #8622 for details.

Closes #8625.

PiperOrigin-RevId: 253242115
bazel-io pushed a commit that referenced this issue Jun 17, 2019
*** Reason for rollback ***

Broke Bazel downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1039#72cf19a2-072a-4ca1-ace2-37c458ef8420

Fixes #8645.

*** Original change description ***

Add --incompatible_use_platforms_repo_for_constraints

This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
#8622

Tracking issue:
#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See #8622 f...

***

PiperOrigin-RevId: 253544711
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.

Closes bazelbuild#8625.

PiperOrigin-RevId: 253242115
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
*** Reason for rollback ***

Broke Bazel downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1039#72cf19a2-072a-4ca1-ace2-37c458ef8420

Fixes bazelbuild#8645.

*** Original change description ***

Add --incompatible_use_platforms_repo_for_constraints

This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 f...

***

PiperOrigin-RevId: 253544711
bazel-io pushed a commit that referenced this issue Jun 21, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
#8622

Tracking issue:
#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See #8622 for details.

Closes #8625.

This is encore of 332379a. Previous implementation failed with dependency cycle with the configuration. In this attempt I don't use selects, but I've put the incompatible flag checking logic directly into the alias rule. Not nice, but get's thing done.

RELNOTES:
PiperOrigin-RevId: 254357477
siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.

Closes bazelbuild#8625.

PiperOrigin-RevId: 253242115
siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
*** Reason for rollback ***

Broke Bazel downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1039#72cf19a2-072a-4ca1-ace2-37c458ef8420

Fixes bazelbuild#8645.

*** Original change description ***

Add --incompatible_use_platforms_repo_for_constraints

This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 f...

***

PiperOrigin-RevId: 253544711
siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.

Closes bazelbuild#8625.

This is encore of bazelbuild@332379a. Previous implementation failed with dependency cycle with the configuration. In this attempt I don't use selects, but I've put the incompatible flag checking logic directly into the alias rule. Not nice, but get's thing done.

RELNOTES:
PiperOrigin-RevId: 254357477
bazel-io pushed a commit that referenced this issue Jul 10, 2019
Baseline: 2e374a9

Cherry picks:

   + 6d0b14b:
     rule_test: apply "tags" to all rules in the macro

Incompatible changes:

  - Add --incompatible_enable_profile_by_default to enable the JSON
    profile by default.
  - The --incompatible_windows_style_arg_escaping flag is flipped to
    "true", and the "false" case unsupported. Bazel no longer accepts
    this flag.

Important changes:

  - Bazel now supports hiding compiler warnings for targets that
    you're not explicitly building (see
    https://docs.bazel.build/versions/master/user-manual.html#flag--au
    to_output_filter).
  - Flag `--incompatible_restrict_escape_sequences` is added. See
    #8380
  - The "info" command now supports the "starlark-semantics"
    argument, which outputs a representation of the effective Starlark
    semantics option values.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - `@bazel_tools//tools/jdk:toolchain_java10` and
    `@bazel_tools//tools/jdk:toolchain_java11` are now available to
    enable java 10, respectively java 11 language level support.
  - The `command` parameter of the `actions.run_shell()` function
    will be restricted to only accept strings (and not string
    sequences). This check is attached to flag
    `--incompatible_run_shell_command_string`. One may migrate by
    using the `arguments` parameter of `actions.run()` instead. See
    #5903 for more info.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 f...
  - Bazel's C++ autoconfiguration now understands `BAZEL_LINKLIBS`
    environment variable to specify system libraries that should be
    appended to the link command line.
  - paths under the execution root starting with "." or "_" will be
    re-linked across builds
  - execution_log_json_file now allows actions without outputs.
  - Labels aapt as deprecated for aapt_version, and heavily endorses
    aapt2.
  - Update doc links still pointing to cc_binary.features to point to
    common features
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
    RELNOTES:
  - --incompatible_disable_nocopts flag has been added. See
    #8706 for details.
  - Fixed treatment of <dist:module /> tags in AndroidManifest.xml
  - Fixed asset precedence for android_binary rules with aapt2.
  - Bazel now officially supports running on CentOS 7.
  - The runtime dynamic libraries are no longer in default output
    group of cc_binary.
  - set the FDOBuildType as CSFDO for binaries built with
    --cs_fdo_absolute_path.
  - Bazel can now be bootstrapped and built on arm64 platforms
    without requiring any flags or patches.
  - Fixed treatment of AndroidManifest.xml attributes which contained
    XML escaping
  - Retire experimental blaze flag
    experimental_link_compile_output_separately. The same behavior is
    available through the feature dynamic_link_test_srcs.
  - --incompatible_load_java_rules_from_bzl was added to forbid
    loading the native java rules directly. See more on tracking
    issue #8746
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Attribute names are going to be restricted and must be
    syntactically valid identifiers.
    #6437
  - rule_test: fix Bazel 0.27 regression ("tags" attribute was
    ingored, #8723

This release contains contributions from many people at Google, as well as Ben Diuguid, Benjamin Peterson, Dave Lee, Loo Rong Jie, Mark Butcher, Marwan Tammam, Pedro Alvarez.
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.

Closes bazelbuild#8625.

PiperOrigin-RevId: 253242115
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
*** Reason for rollback ***

Broke Bazel downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1039#72cf19a2-072a-4ca1-ace2-37c458ef8420

Fixes bazelbuild#8645.

*** Original change description ***

Add --incompatible_use_platforms_repo_for_constraints

This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 f...

***

PiperOrigin-RevId: 253544711
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
This change adds an incompatible flag to disable constrains bundled with Bazel
in @bazel_tools.

Incompatible change issue:
bazelbuild#8622

Tracking issue:
bazelbuild#6516

RELNOTES: Incompatible change `--incompatible_use_platforms_repo_for_constraints` has been added. See bazelbuild#8622 for details.

Closes bazelbuild#8625.

This is encore of bazelbuild@332379a. Previous implementation failed with dependency cycle with the configuration. In this attempt I don't use selects, but I've put the incompatible flag checking logic directly into the alias rule. Not nice, but get's thing done.

RELNOTES:
PiperOrigin-RevId: 254357477
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
Baseline: 2e374a9

Cherry picks:

   + 6d0b14b:
     rule_test: apply "tags" to all rules in the macro

Incompatible changes:

  - Add --incompatible_enable_profile_by_default to enable the JSON
    profile by default.
  - The --incompatible_windows_style_arg_escaping flag is flipped to
    "true", and the "false" case unsupported. Bazel no longer accepts
    this flag.

Important changes:

  - Bazel now supports hiding compiler warnings for targets that
    you're not explicitly building (see
    https://docs.bazel.build/versions/master/user-manual.html#flag--au
    to_output_filter).
  - Flag `--incompatible_restrict_escape_sequences` is added. See
    bazelbuild#8380
  - The "info" command now supports the "starlark-semantics"
    argument, which outputs a representation of the effective Starlark
    semantics option values.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - `@bazel_tools//tools/jdk:toolchain_java10` and
    `@bazel_tools//tools/jdk:toolchain_java11` are now available to
    enable java 10, respectively java 11 language level support.
  - The `command` parameter of the `actions.run_shell()` function
    will be restricted to only accept strings (and not string
    sequences). This check is attached to flag
    `--incompatible_run_shell_command_string`. One may migrate by
    using the `arguments` parameter of `actions.run()` instead. See
    bazelbuild#5903 for more info.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See bazelbuild#8622 for
    details.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See bazelbuild#8622 f...
  - Bazel's C++ autoconfiguration now understands `BAZEL_LINKLIBS`
    environment variable to specify system libraries that should be
    appended to the link command line.
  - paths under the execution root starting with "." or "_" will be
    re-linked across builds
  - execution_log_json_file now allows actions without outputs.
  - Labels aapt as deprecated for aapt_version, and heavily endorses
    aapt2.
  - Update doc links still pointing to cc_binary.features to point to
    common features
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See bazelbuild#8622 for
    details.
    RELNOTES:
  - --incompatible_disable_nocopts flag has been added. See
    bazelbuild#8706 for details.
  - Fixed treatment of <dist:module /> tags in AndroidManifest.xml
  - Fixed asset precedence for android_binary rules with aapt2.
  - Bazel now officially supports running on CentOS 7.
  - The runtime dynamic libraries are no longer in default output
    group of cc_binary.
  - set the FDOBuildType as CSFDO for binaries built with
    --cs_fdo_absolute_path.
  - Bazel can now be bootstrapped and built on arm64 platforms
    without requiring any flags or patches.
  - Fixed treatment of AndroidManifest.xml attributes which contained
    XML escaping
  - Retire experimental blaze flag
    experimental_link_compile_output_separately. The same behavior is
    available through the feature dynamic_link_test_srcs.
  - --incompatible_load_java_rules_from_bzl was added to forbid
    loading the native java rules directly. See more on tracking
    issue bazelbuild#8746
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Attribute names are going to be restricted and must be
    syntactically valid identifiers.
    bazelbuild#6437
  - rule_test: fix Bazel 0.27 regression ("tags" attribute was
    ingored, bazelbuild#8723

This release contains contributions from many people at Google, as well as Ben Diuguid, Benjamin Peterson, Dave Lee, Loo Rong Jie, Mark Butcher, Marwan Tammam, Pedro Alvarez.
laurentlb pushed a commit that referenced this issue Jul 16, 2019
Baseline: 2e374a9

Cherry picks:

   + 6d0b14b:
     rule_test: apply "tags" to all rules in the macro

Incompatible changes:

  - Add --incompatible_enable_profile_by_default to enable the JSON
    profile by default.
  - The --incompatible_windows_style_arg_escaping flag is flipped to
    "true", and the "false" case unsupported. Bazel no longer accepts
    this flag.

Important changes:

  - Bazel now supports hiding compiler warnings for targets that
    you're not explicitly building (see
    https://docs.bazel.build/versions/master/user-manual.html#flag--au
    to_output_filter).
  - Flag `--incompatible_restrict_escape_sequences` is added. See
    #8380
  - The "info" command now supports the "starlark-semantics"
    argument, which outputs a representation of the effective Starlark
    semantics option values.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - `@bazel_tools//tools/jdk:toolchain_java10` and
    `@bazel_tools//tools/jdk:toolchain_java11` are now available to
    enable java 10, respectively java 11 language level support.
  - The `command` parameter of the `actions.run_shell()` function
    will be restricted to only accept strings (and not string
    sequences). This check is attached to flag
    `--incompatible_run_shell_command_string`. One may migrate by
    using the `arguments` parameter of `actions.run()` instead. See
    #5903 for more info.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 f...
  - Bazel's C++ autoconfiguration now understands `BAZEL_LINKLIBS`
    environment variable to specify system libraries that should be
    appended to the link command line.
  - paths under the execution root starting with "." or "_" will be
    re-linked across builds
  - execution_log_json_file now allows actions without outputs.
  - Labels aapt as deprecated for aapt_version, and heavily endorses
    aapt2.
  - Update doc links still pointing to cc_binary.features to point to
    common features
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
    RELNOTES:
  - --incompatible_disable_nocopts flag has been added. See
    #8706 for details.
  - Fixed treatment of <dist:module /> tags in AndroidManifest.xml
  - Fixed asset precedence for android_binary rules with aapt2.
  - Bazel now officially supports running on CentOS 7.
  - The runtime dynamic libraries are no longer in default output
    group of cc_binary.
  - set the FDOBuildType as CSFDO for binaries built with
    --cs_fdo_absolute_path.
  - Bazel can now be bootstrapped and built on arm64 platforms
    without requiring any flags or patches.
  - Fixed treatment of AndroidManifest.xml attributes which contained
    XML escaping
  - Retire experimental blaze flag
    experimental_link_compile_output_separately. The same behavior is
    available through the feature dynamic_link_test_srcs.
  - --incompatible_load_java_rules_from_bzl was added to forbid
    loading the native java rules directly. See more on tracking
    issue #8746
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Attribute names are going to be restricted and must be
    syntactically valid identifiers.
    #6437
  - rule_test: fix Bazel 0.27 regression ("tags" attribute was
    ingored, #8723

This release contains contributions from many people at Google, as well as Ben Diuguid, Benjamin Peterson, Dave Lee, Loo Rong Jie, Mark Butcher, Marwan Tammam, Pedro Alvarez.
@dslomov
Copy link
Contributor

dslomov commented Sep 2, 2019

What is the status of this for 1.0?

@hlopko
Copy link
Member Author

hlopko commented Sep 2, 2019

Not flipping in time for 1.0

@smolkaj
Copy link

smolkaj commented Jun 21, 2023

What's the status on this?
It seems that many teams are not upgrading to Bazel 6 since it breaks their build due to this issue.
My team included.

@aiuto
Copy link
Contributor

aiuto commented Jun 21, 2023

What is breaking in you build? Is it because some rules still depend on bazel providing platforms via bazel_tools? There is some indication of that in the linked protobuf issue, but that seemed to wither on the vine as inconclusive.

@aranguyen Do you know of anything that is breaking downstream?

To be clear, any fix involves moving the ecosystem to rely on @platforms rather than @bazel_tools.

@smolkaj
Copy link

smolkaj commented Jun 21, 2023

For one, it is braking protobuf's build, and we depend on protobuf: protocolbuffers/protobuf#12509

@aranguyen
Copy link
Contributor

@aiuto All downstream projects that are tracked by our CI are all green. For other untracked projects, users need to migrate their code away from using contraints from bazel_tools.

protocolbuffers/protobuf#12509 (comment) mentioned that https://github.com/protocolbuffers/protobuf is green and the error doesn't seem to be related to this flag. Have you tried updating your protobuf dependency to latest version which should have been migrated.

@aiuto
Copy link
Contributor

aiuto commented Jun 22, 2023

Now that the flag is in the graveyard. Can you delete tools/platforms/...
I'm not sure if there is a distinct issue for that, but it should happen before bazel 7.

@mgarbade
Copy link

mgarbade commented Aug 4, 2023

This is breaking my build. I was trying to compile an older version of MediaPipeUnityPlugin (which I was able to do successfully 2 years ago) and now I'm getting into a dependency hell, apparently due to the above change.

What is the point of having bazel to fight against the dependency hell and then changing bazel itself throwing people into another dependency hell?

Anyway. I changed the following line in my WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

by

load("@platforms//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "platforms",
    url = "https://github.com/bazelbuild/platforms/archive/v3.7.2.tar.gz",
    # The VERSION here is a guess, as I don't know what exact version to use for the project.
)

it does not compile giving me the following error:

E:\Git\Homuler\mpup_v0.6.2_p3>python build.py build --desktop cpu --opencv=cmake -v
INFO (build.py): Building protobuf sources...
DEBUG (build.py): Running `bazel --output_user_root C:/_bzl build -c opt --action_env PYTHON_BIN_PATH=C://Users//garbade//.pyenv-win//shims//python //mediapipe_api:mediapipe_proto_srcs`
ERROR: Failed to load Starlark extension '@platforms//tools/build_defs/repo:http.bzl'. 
Cycle in the workspace file detected. This indicates that a repository is used prior to being 
defined.The following chain of repository dependencies lead to the missing definition.
- @platforms
This could either mean you have to add the '@platforms' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: Error computing the main repository mapping: cycles detected during computation of main repo
mapping
Loading:
Traceback (most recent call last):
File "E:\Git\Homuler\mpup_v0.6.2_p3\build.py", line 392, in <module>
Argument().command().run()
File "E:\Git\Homuler\mpup_v0.6.2_p3\build.py", line 109, in run
self._run_command(self._build_proto_srcs_commands())
File "E:\Git\Homuler\mpup_v0.6.2_p3\build.py", line 51, in _run_command
return subprocess.run(command_list, check=True)
File "C:\Users\garbade\.pyenv\pyenv-win\versions\3.9.13\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bazel', '--output_user_root', 'C:/_bzl', 'build', '-c', 'opt', '--action_env', 'PYTHON_BIN_PATH=C://Users//garbade//.pyenv-win//shims//python', '//mediapipe_api:mediapipe_proto_srcs']' returned non-zero exit status 37.                                                                                                                                                                  ```

@aiuto
Copy link
Contributor

aiuto commented Aug 6, 2023

What is the point of having bazel to fight against the dependency hell and then changing bazel itself throwing people into another dependency hell?

That's a good question, and I appreciate that this is difficult for some users. That is one of the reasons this has taken so long to roll out. This particular change is specifically to decouple bazel versions from the ability to build for new hardware. Let's say Bazel 6 had a set of CPUs built in based on what was made in 2022, and rules depend on that version of platforms. You want to use Bazel 6 for a 5 year long project, but new hardware keeps being developed. So you want to build the 3rd generation of your device with a new RISC-V variant. You don't want to have to update Bazel to pick up a new CPU name. Instead, you just want to pick up a new version of platforms.

@martis42
Copy link

martis42 commented Aug 6, 2023

I am quite happy Bazel is performing breaking changes. Imho the workflow based on incompatibility flags is working well and giving each project the possibility to adjust in its own pace.
I am working a lot with C++ and would hate to see Bazel running into the same problem of ever growing complexity and need for best practices and linters just because nothing is ever deprecated.

@mgarbade
Copy link

mgarbade commented Aug 7, 2023

  • If I grep for "bazel_tools//platforms" in my clean project. I does not find anything
  • once I start building with bazel the above mentioned error (Constraints from @bazel_tools//platforms have been removed) appears
  • checking with "grep" all files containing the string "bazel_tools//platforms" are in a newly created folder called ".cache" so it's been created during build process

I guess there is not point in find/replace anything inside these cache files. I have to make it earlier, I guess.

Can someone tell me how to fix this?

Are there some lines I should add to WORKSPACE to avoid these deprecated .cache files from being checked out?

@aranguyen
Copy link
Contributor

aranguyen commented Aug 24, 2023

@mgarbade sorry I missed this message. You can try doing the following to see where in your project still depends on @bazel_tools//platforms

  1. bazel build --nobuild <~target>
  2. bazel info output_base - this step should give you the path to your build output directory
  3. grep -r "@bazel_tools//platforms" <~output-from-step-2>

Example output from 3:

/private/var/tmp/_bazel_aranguyen/6e8429b404ae33f1dc5940e048063ac1/external/bazel_toolchains/configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan/BUILD:        "@bazel_tools//platforms:autoconfigured",
/private/var/tmp/_bazel_aranguyen/6e8429b404ae33f1dc5940e048063ac1/external/bazel_toolchains/configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan/BUILD:        "@bazel_tools//platforms:arm",
/private/var/tmp/_bazel_aranguyen/6e8429b404ae33f1dc5940e048063ac1/external/bazel_toolchains/configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan/BUILD:        "@bazel_tools//platforms:android",
/private/var/tmp/_bazel_aranguyen/6e8429b404ae33f1dc5940e048063ac1/external/bazel_toolchains/configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan/BUILD:        "@bazel_tools//platforms:x86_64",

You can see in the example that it tells me in bazel_toolchains there was still dependency on @bazel_tools//platforms so you can fix those.

danigar pushed a commit to masmovil/masorange_rules_helm that referenced this issue Sep 25, 2023
atobiszei added a commit to openvinotoolkit/model_server that referenced this issue Sep 28, 2023
atobiszei added a commit to openvinotoolkit/model_server that referenced this issue Oct 5, 2023
atobiszei added a commit to openvinotoolkit/model_server that referenced this issue Oct 9, 2023
* Bump oneTBB to avoid using deprecated selection in build files
bazelbuild/bazel#8622
* Bump TF and remove patches
* Fix oneTBB patch
* Fix order of glog include
* Fixes in UT's after gtest bump
Gtest now detects that there are parametrized fixtures and there is no
instantiation of that fixture and reports that a test failure.
* Update TFS Model Metadata tests after TFS update
With updated TFS the model metadata response through REST API contains
additional field.
* New patch for TF after update

JIRA:CVS-114360
atobiszei added a commit to openvinotoolkit/model_server that referenced this issue Oct 11, 2023
* Bump oneTBB to avoid using deprecated selection in build files
bazelbuild/bazel#8622
* Bump TF and remove patches
* Fix oneTBB patch
* Fix order of glog include
* Fixes in UT's after gtest bump
Gtest now detects that there are parametrized fixtures and there is no
instantiation of that fixture and reports that a test failure.
* Update TFS Model Metadata tests after TFS update
With updated TFS the model metadata response through REST API contains
additional field.
* New patch for TF after update
* Update tests requirements after functional tests update

JIRA:CVS-114360

* Fixing python=0 compilation
Co-authored-by: rasapala <rafal.a.sapala@intel.com>
kunitoki pushed a commit to kunitoki/googletest that referenced this issue Nov 4, 2023
@platforms//os:* instead of from @build_tools//platforms:*

See bazelbuild/bazel#8622

Necessary to fix google#4096

Also need the fix for google#4098

PiperOrigin-RevId: 497182073
Change-Id: Ifd568b088d2f779755dd20264edfd5dad12ca9cc
warriorstar-orion added a commit to warriorstar-orion/third_party_buildfiles that referenced this issue Dec 22, 2023
See bazelbuild/bazel#8622

MacOS sed commands:

sed -E -i '' 's$@bazel_tools//platforms:(cpu|x86_32|x86_64|ppc|arm|aarch64|s390x)$@platforms//cpu:\1$' buildfiles/*.BUILD
sed -E -i '' 's$@bazel_tools//platforms:(linux|osx|windows|android|freebsd|ios|os)$@platforms//os:\1$' buildfiles/*.BUILD
@cleebp
Copy link

cleebp commented Feb 4, 2024

Ran into this error (below) when building the tensorflow suite of packages with conda, if you hit this when trying to bazel build tflite-support specifically (latest source) just make sure to use bazel<6.

ERROR: /home/user/.cache/bazel/_bazel_user/0e16d8232bb98776571a500cc0c256cb/external/bazel_tools/platforms/BUILD:64:6: Analysis of target '@bazel_tools//platforms:ios' failed

psakamoori pushed a commit to psakamoori/model_server that referenced this issue Apr 2, 2024
* Bump oneTBB to avoid using deprecated selection in build files
bazelbuild/bazel#8622
* Bump TF and remove patches
* Fix oneTBB patch
* Fix order of glog include
* Fixes in UT's after gtest bump
Gtest now detects that there are parametrized fixtures and there is no
instantiation of that fixture and reports that a test failure.
* Update TFS Model Metadata tests after TFS update
With updated TFS the model metadata response through REST API contains
additional field.
* New patch for TF after update
* Update tests requirements after functional tests update

JIRA:CVS-114360

* Fixing python=0 compilation
Co-authored-by: rasapala <rafal.a.sapala@intel.com>
@yjianpen
Copy link

This breaks my repo: /private/var/tmp/_bazel_javieryu/aa8e4725bf9c05d07d76211f768b2ac1/external/local_execution_config_platform/BUILD:17:9: no such package '@@bazel_tools//platforms': BUILD file not found in directory 'platforms' of external repository @@bazel_tools.

Any idea to find where this error message come from?

@katre
Copy link
Member

katre commented Jun 17, 2024

From the error, looks like the problem is local_execution_config_platform/BUILD. I don't know what defines this, you'll need to check your WORKSPACE or MODULE.bazel file and see.

danigar added a commit to masmovil/masorange_rules_helm that referenced this issue Nov 20, 2024
* feat: support gcp artifact registry as repo for pushing helm charts

* fix: helpers load import

* fix: toolchain reference

* fix: add gcloud toolchains

* fix: reference to masmovil_bazel_rules workspace

* fix: use helm toolchain tool as binary

* Revert "fix: use helm toolchain tool as binary"

This reverts commit e7d51af.

* fix: helm toolchain

* Revert "fix: helm toolchain"

This reverts commit 8a4432a.

* fix: helm 3 binary path on helm push rule

* fix: import wrong toolchain name

* upgrade helm to version 3.8

* Replace `@bazel_tools//platforms` with `@platforms//os` (#59)

Context: bazelbuild/bazel#8622

* Update sops to 3.7.3, splitting arm64/amd64 versions for linux/darwin.  Permits sops_decrypt() on M2 Mac (#57)

* feat: update sops

* fix: missing platform os in gcloud toolchain template

* fix: typo

* feat: enable oci_image rules support and bazelmod

* feat: enable bazel.module file

* feat: support custom bazelrc.user config

* feat(helm_chart): support extracting image digest from oci_image rules

* fix: module.bazel declaration

Do not load repositories macro from module.bazel file

* feat: rename module name from com_github_masmovil_bazel_rules to masmovil_bazel_rules

* feat: enable bazel dependencies using bzlmod

* feat: refactor helm toolchains to be used as a bzlmod extension

* feat: reimplement helm package bazel rule

* chore: move helm rules to private dir under helm directory

* feat: support registering helm toolchains via repo rule invokation instead of extension

* feat: remove yq toolchain dependency in favor of aspect_lib toolchain

* fix: do not use helm out name for helm toolchain

* fix: path to invoke helm toolchain binary

* feat: reimplement helm_push rule

* feat: implement toolchain_resolved_type for helm toolchain to be able to be imported from a genrule

* feat: refactor helm_release rule adding new rule attributes to it:
- set attribute

* feat: comment out use of short_path in run rule

* feat: remove unnecessary flags for helm_package

* feat: implement new helm_lint_test macro using sh_test

* fix: typo in helm.bzl definition

* feat: add sops, gcloud and kubectl toolchains

* feat: reimplement sops rule using macro and bazel rule

* feat: adapt kubectl rule to use new toolchain

* feat: simplify gcs upload rule

* feat: implement helm_uninstall rule

* fix: augment arguments in helm_release rule

* feat: refactor helm file names

* feat: reimplement helm chart rule using pkg_tar to make helm package operation reproducible

* feat: use pkg tar to create tgz chart

* feat: support modifying chart manifest using yq

* feat: remove dead code

* feat: remove unused helm sh template

* feat: support chart dependencies through providers

* feat: implements helm_pull repository rull to fetch external helm charts

* feat: add basic lint and build tests for helm_chart rule

* feat: remove dead code

* feat: remove unused args

* tests: support testing charts with dependencies and no chart manifest

* tests: implement integration tests for helm_chart rule

* fix: extract digest from oci images

* feat: refactor test_chart compare to yaml function

* fix: remove unnecessary comment

* test: test chart with dependencies

* test: support diff deps values and chart.yaml manifest

* test: add test of chart with two dependencies

* fix: tests charts

* feat: refactor helm_chart rule implementation

* feat: support images from docker and oci image rules

* feat: upgrade bazel to 6.4.0

* feat: support repoconfig and userpass in helm_pull repo rule

* feat: refactor module extensions to support toolchains install and pull util

* chore: remove unused imports from chart_srcs rule file

* feat: add stamping support in helm chart rule

* feat: support chart dependencies conditions via helm_chart attr

* feat: add path_to_chart additional atttr in helm_chart rule

* feat: use depset for values input in chart_src rule

* feat: add structure to doc rules, macros and providers using stardoc

* feat: add stardoc dependency

* chore: remove gpg toolchain

* doc: add attr and docs for chart_srcs rule

* feat: support additional templates in helm_charts

* docs: add stardoc rules to generate docs for helm rules

* feat: modify how iamge.digest is exposed to helm rule

* docs: improve doc usability for helm rules

* docs: improve typos and redability of some helm rules

* doc: improve example of use docs in helm_pull repository rule

* docs: add documentation for sops, k8s and gcs rules using stardoc

* docs: improve helm_chart docs header info

* docs: improve info about helm_chart arguments

* docs: minor improvements in helm_chart docs

* docs: rename gcs and sops markdown files

* chore: add .DS_Store file to gitignore

* test: remove test directory

* feat: remove unmantained examples dir

* feat: add stamp script used for testing pourposes

* chore: add bzlmod lockfile

* docs: update readme.md

* docs: improve doc definition in helm_lint test

* chore: remove unused repositories folder

* chore: remove unusde internal_deps bzl file

* fix: add missing repositories file

* feat: refactor helm toolchain impl

* feat: refactor all toolchains to be placed inside rules folders

* chore: remove unused legacy files

* feat: update external deps

* feat: move repo stuff to be able to load it from bazel workspace mod

* feat: improve helm_push functionality

* doc: improve readme redability

* feat: support sha256 format in digest files

* feat: remove unnecessary workspace name from imports

* chore: downgrade rules_pkg to version 0.9.1  to fix stardoc dependency

* doc: add info about force repository attr in helm_chart rule

* doc: add info to stamp values in helm_chart values attribute

* fix: hack to propagate visibility to chart rules behind helm_chart macro

* fix: remove duplicated visibility arg in chart_srcs

* fix: remove visibility attr from test rule

* fix: do not use sha256 attr in helm pull repo rule

* fix: use helm args to perform helm pull

* fix: use repo_url instead of repo_name in helm_pull repository rule

* fix: do not append chart_name to helm push command

* fix: remove sha256 attr from helm pull rule

* feat: remove possible BUILD files in chart downlad and expose chart info using dict

* feat(helm-release): avoid adding namespace flag to helm release if no namespace or namespace dep is provided

* fix(helm-release): typo with quotes escape

* fix(gcs_upload): modify subpackage visibility of gcs_upload private folder

* test: comment out deprecated helm_pull test

* doc(helm_release): update md docs for namespace attribute

* fix: remove tgz go deps

* ci: execute unit tests using ci config

* doc: disable write_source_files tests

* fix(docs): use right import of stardoc rule

* docs: update docs generation using new stardoc version

* fix: load yq toolchains

* docs: recover docs generated with stardoc v0.6

* chore: remove legacy workspace file

* chore: enable bzlmod by default

* chore: add bzlmod lockfile changes

* chore: add empty workspace file

* docs: add contribute title to main docs

* chore: change module.bazel version to v1

---------

Co-authored-by: Nick De Cooman <nickdecooman@users.noreply.github.com>
Co-authored-by: Allan Clark <allanc@chickenandporn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change-6.0 Incompatible flags to be flipped in Bazel 6.0 incompatible-change Incompatible/breaking change migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions type: process
Projects
None yet
Development

No branches or pull requests