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

No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type #10

Closed
fcorange opened this issue Oct 2, 2020 · 10 comments

Comments

@fcorange
Copy link

fcorange commented Oct 2, 2020

Hitting below error when trying out the example on mac:

ERROR: While resolving toolchains for target @dbx_build_tools//build_tools/py:check_conflicts: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.

Some googling suggests that this might be related to Bazel remote execution. Is this expected?

FYI I had to revert the python 3.7 removal commit, otherwise getting below error:

no such target '@dbx_build_tools//thirdparty/cpython:drte-off-38-toolchain': target 'drte-off-38-toolchain' not declared in package 'thirdparty/cpython' (did you mean 'drte-off-37-toolchain'?)

@armooo
Copy link
Contributor

armooo commented Oct 2, 2020

I think part of the problem could be the README.md pinning a version from Dec 11 but was updated to use python38. What version of dbx_build_tools and bazel are you using?

@fcorange
Copy link
Author

fcorange commented Oct 2, 2020

I was following the README here https://github.com/dropbox/dbx_build_tools/blob/master/README.md

I tried both latest Bazel (3.5.1) and 1.1.0, both returned similar errors.

@armooo
Copy link
Contributor

armooo commented Oct 2, 2020

Can you give this WORKSPACE a try? If it works I will make sure to update the README.

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

http_archive(
    name = "dbx_build_tools",
    urls = ["https://github.com/dropbox/dbx_build_tools/archive/master.tar.gz"],
    strip_prefix = "dbx_build_tools-master",
)

load('@dbx_build_tools//build_tools/bazel:external_workspace.bzl', 'drte_deps')

drte_deps()

register_toolchains(
    "@dbx_build_tools//thirdparty/cpython:drte-off-27-toolchain",
    "@dbx_build_tools//thirdparty/cpython:drte-off-38-toolchain",
)

@fcorange
Copy link
Author

fcorange commented Oct 2, 2020

No luck :( still hitting the first error I mentioned above. Tried on both Bazel 1.1.0 and 3.5.1. Guess I'll just input my issue to bazelbuild/bazel#10134. Thanks for looking though!

@benjaminp
Copy link
Contributor

I think we would have to know all the Bazel options in play to debug this.

@fcorange
Copy link
Author

fcorange commented Oct 5, 2020

I switched to a different environment (with Bazel 1.1.0) and with @armooo 's suggested WORKSPACE it now emits a different error:

ERROR: .../dbx_build_tools/build_tools/bzl_lib/itest/BUILD:27:1: in dbx_sh_binary rule @dbx_build_tools//build_tools/bzl_lib/itest:bzl-itest-init:
Traceback (most recent call last):
	File ".../dbx_build_tools/build_tools/bzl_lib/itest/BUILD", line 27
		dbx_sh_binary(name = 'bzl-itest-init')
	File ".../dbx_build_tools/build_tools/sh/sh.bzl", line 9, in dbx_sh_binary_impl
		write_runfiles_tmpl(ctx, <2 more arguments>)
	File ".../dbx_build_tools/build_tools/bazel/runfiles.bzl", line 50, in write_runfiles_tmpl
		is_windows(ctx)
	File ".../dbx_build_tools/build_tools/windows/windows.bzl", line 2, in is_windows
		ctx.target_platform_has_constraint(<1 more arguments>)
	File ".../dbx_build_tools/build_tools/windows/windows.bzl", line 2, in ctx.target_platform_has_constraint
		platform_common.ConstraintValueInfo
object of type 'platform_common' has no field 'ConstraintValueInfo'
ERROR: Analysis of target '@dbx_build_tools//build_tools:bzl' failed; build aborted: Analysis of target '@dbx_build_tools//build_tools/bzl_lib/itest:bzl-itest-init' failed; build aborted

For last week's experiment I was basically trying with a fresh Bazel (3.5.1) installation from brew. Not sure what other Bazel options you might need to debug this issue.

@benjaminp
Copy link
Contributor

1.1.0 is really old and definitely will not work.

@fcorange
Copy link
Author

fcorange commented Oct 6, 2020

(Edit: same setup worked fine on ubuntu. Seems to be a mac env related issue.)

Did a bit digging into this issue.

Environment:
OS: Mac OS Catalina 10.15.5
Bazel version 3.1.0
.bazelrc and WORKSPACE from current README.md @ HEAD (3245b6f)

Error occurred when trying to build bzl (bazel build @dbx_build_tools//build_tools:bzl):

ERROR: While resolving toolchains for target @dbx_build_tools//build_tools/py:check_conflicts: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.

Adding --toolchain_resolution_debug to the build command gives more details:

INFO: ToolchainResolution:     Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform @dbx_build_tools//build_tools/cc:linux-x64-drte-off
INFO: ToolchainResolution:   Rejected toolchain @local_config_cc//:cc-compiler-watchos_x86_64, because of target platform mismatch
INFO: ToolchainResolution:   No toolchains found

It seems that the error has something to do with execution platform. I commented out build --host_platform @dbx_build_tools//build_tools/cc:linux-x64-drte-off line in .bazelrc file and this time it gave a different error:

ERROR: .../dbx_build_tools/build_tools/BUILD:68:1: in dbx_py_binary rule @dbx_build_tools//build_tools:bzl:
Traceback (most recent call last):
	File ".../dbx_build_tools/build_tools/BUILD", line 68
		dbx_py_binary(name = 'bzl')
	File ".../dbx_build_tools/build_tools/py/py.bzl", line 610, in _dbx_py_binary_impl
		dbx_py_binary_base_impl(ctx, <1 more arguments>)
	File ".../dbx_build_tools/build_tools/py/py.bzl", line 659, in dbx_py_binary_base_impl
		emit_py_binary(ctx, main = main, <10 more arguments>)
	File ".../dbx_build_tools/build_tools/py/common.bzl", line 416, in emit_py_binary
		conflict_args.add_all(<2 more arguments>)
map_each must be a function that accepts a single positional argument

@benjaminp
Copy link
Contributor

I should have mentioned earlier that various things like our CPython are Linux-specific today. So, even if this immediate toolchain problem is overcome, there will be more failures.

@fcorange
Copy link
Author

Thanks, yes I've since switched to a Ubuntu image running in a containerized env and it works fine now.

I did run into an issue though with latest master head, I've attached details in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants