tensorflow: Build error: No matching toolchains on ppc64le

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ppc64le, CentOS 7 manylinux 2014 container
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow installed from (source or binary): source
  • TensorFlow version: master branch
  • Python version: 3.6
  • Installed using virtualenv? pip? conda?: N/A
  • Bazel version (if compiling from source): 3.0.0
  • GCC/Compiler version (if compiling from source): 8.3.1
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A

Describe the problem

This commit: https://github.com/tensorflow/tensorflow/commit/f5bb64336039646cae91884f7177bdcb6f29a7e2, broke the build on ppc64le.

builds on ppc64le have been working fine until that commit. To do a build with that commit, I must modify third_party/remote_config/BUILD.tpl to replace with platforms:x86_64 with platforms:ppc.

Provide the exact sequence of commands / steps that you executed before running into the problem

git clone https://github.com/tensorflow/tensorflow
cd tensorflow
./configure (accept all defaults)
bazel build -c opt --config=v2 --local_cpu_resources 4 --local_ram_resources 4096 //tensorflow/tools/pip_package:build_pip_package

Any other info / logs build fails with:

ERROR: While resolving toolchains for target //tensorflow/tools/build_info:gen_build_info: 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.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: 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.

if I add --toolchain_resolution_debug to the command line:

bazel build -c opt --config=v2 --local_cpu_resources 4 --local_ram_resources 4096 --toolchain_resolution_debug //tensorflow/tools/pip_package:build_pip_package

I get this additional debug:

INFO: Build option --toolchain_resolution_debug has changed, discarding analysis cache.
INFO: ToolchainResolution: Selected execution platform @local_execution_config_platform//:platform,
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:ppc from the target platform @local_config_platform//:host
INFO: ToolchainResolution:     Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution:   Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-ppc...
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:ppc, which does not match value @platforms//cpu:x86_64 from the execution platform @local_execution_config_platform//:platform
INFO: ToolchainResolution:   For toolchain type @bazel_tools//tools/cpp:toolchain_type, possible execution platforms and toolchains: {@local_config_platform//:host -> @local_config_cc//:cc-compiler-ppc}
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/python:toolchain_type...
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/python:toolchain_type...
INFO: ToolchainResolution:   Considering toolchain @local_execution_config_python//:py_runtime_pair...
INFO: ToolchainResolution: Selected execution platform @local_execution_config_platform//:platform,
INFO: ToolchainResolution:     Toolchain constraint @local_execution_config_platform//:platform_setting has value @local_execution_config_platform//:platform_constraint, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution:   Rejected toolchain @local_execution_config_python//:py_runtime_pair, because of target platform mismatch
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution:   Considering toolchain @local_execution_config_python//:py_runtime_pair...
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:ppc from the target platform @local_config_platform//:host
INFO: ToolchainResolution:   Considering toolchain @local_config_python//:py_runtime_pair...
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-ppc
INFO: ToolchainResolution:     Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution:     Toolchain constraint @local_execution_config_platform//:platform_setting has value @local_execution_config_platform//:platform_constraint, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution:   Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution:   Considering toolchain @bazel_tools//tools/python:_autodetecting_py_runtime_pair...
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-ppc...
INFO: ToolchainResolution:   Rejected toolchain @local_execution_config_python//:py_runtime_pair, because of target platform mismatch
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:ppc, which does not match value @platforms//cpu:x86_64 from the execution platform @local_execution_config_platform//:platform
INFO: ToolchainResolution:   For toolchain type @bazel_tools//tools/python:toolchain_type, possible execution platforms and toolchains: {@local_execution_config_platform//:platform -> @local_config_python//:py_runtime_pair, @local_config_platform//:host -> @local_config_python//:py_runtime_pair}
INFO: ToolchainResolution: Selected execution platform @local_execution_config_platform//:platform,
INFO: ToolchainResolution:   For toolchain type @bazel_tools//tools/cpp:toolchain_type, possible execution platforms and toolchains: {@local_config_platform//:host -> @local_config_cc//:cc-compiler-ppc}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-ppc
INFO: ToolchainResolution:   Considering toolchain @local_config_python//:py_runtime_pair...
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-ppc, type @bazel_tools//tools/python:toolchain_type -> toolchain @local_config_python//:py_runtime_pair
INFO: ToolchainResolution: Removed execution platform @local_config_platform//:host from available execution platforms, it is missing constraint @local_execution_config_platform//:platform_constraint
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_execution_config_platform//:platform
INFO: ToolchainResolution:   Considering toolchain @bazel_tools//tools/python:_autodetecting_py_runtime_pair...
INFO: ToolchainResolution:     Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_execution_config_platform//:platform
INFO: ToolchainResolution:   Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/python:toolchain_type...
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution:   Considering toolchain @local_execution_config_python//:py_runtime_pair...
INFO: ToolchainResolution:   Considering toolchain @local_config_cc//:cc-compiler-ppc...
INFO: ToolchainResolution:   For toolchain type @bazel_tools//tools/python:toolchain_type, possible execution platforms and toolchains: {@local_execution_config_platform//:platform -> @local_config_python//:py_runtime_pair, @local_config_platform//:host -> @local_config_python//:py_runtime_pair}
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:ppc, which does not match value @platforms//cpu:x86_64 from the target platform @local_execution_config_platform//:platform
INFO: ToolchainResolution:   Considering toolchain @local_config_python//:py_runtime_pair...
INFO: ToolchainResolution:     Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_execution_config_platform//:platform
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-ppc, type @bazel_tools//tools/python:toolchain_type -> toolchain @local_config_python//:py_runtime_pair
INFO: ToolchainResolution:   Considering toolchain @bazel_tools//tools/python:_autodetecting_py_runtime_pair...
INFO: ToolchainResolution:   Rejected toolchain @local_config_cc//:cc-compiler-ppc, because of target platform mismatch
INFO: ToolchainResolution:   No toolchains found
INFO: ToolchainResolution:   For toolchain type @bazel_tools//tools/python:toolchain_type, possible execution platforms and toolchains: {@local_execution_config_platform//:platform -> @local_execution_config_python//:py_runtime_pair}
INFO: ToolchainResolution:     Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_execution_config_platform//:platform

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Does this work for you?

diff --git a/third_party/remote_config/remote_platform_configure.bzl 
b/third_party/remote_config/remote_platform_configure.bzl
index 185120f762..5122d090ae 100644
--- a/third_party/remote_config/remote_platform_configure.bzl
+++ b/third_party/remote_config/remote_platform_configure.bzl
@@ -12,13 +12,12 @@ def _remote_platform_configure_impl(repository_ctx):
             platform = "linux"

     cpu = "x86_64"
-    if "MACHTYPE" in repository_ctx.os.environ:
-        machine_type = repository_ctx.os.environ["MACHTYPE"]
-        if (machine_type.startswith("ppc") or
-            machine_type.startswith("powerpc")):
-            cpu = "ppc"
-        elif machine_type.startswith("s390x"):
-            cpu = "s390x"
+    machine_type = repository_ctx.execute(['bash', '-c', 'echo $MACHTYPE']).stdout
+    if (machine_type.startswith("ppc") or
+        machine_type.startswith("powerpc")):
+        cpu = "ppc"
+    elif machine_type.startswith("s390x"):
+        cpu = "s390x"

     exec_properties = repository_ctx.attr.platform_exec_properties