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/bazel-rules 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.

This issue was closed.
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