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

cc_test targets fail to build for linux-arm64 #15

Closed
mcevoypeter opened this issue Nov 10, 2022 · 1 comment
Closed

cc_test targets fail to build for linux-arm64 #15

mcevoypeter opened this issue Nov 10, 2022 · 1 comment
Labels
bug Something isn't working build Related to the build system

Comments

@mcevoypeter
Copy link

Description

All cc_test targets fail to build when targeting linux-arm64 because of a failure to detect a suitable toolchain. Toolchain resolution for tests apparently differs from library and binary targets, presumably because tests are built for the execution platform rather than the target platform by default.

Reproduction Steps

To reproduce, run the following on an x86_64 machine with Linux and version 12.2.0 of aarch64-linux-gnu-gcc installed:

% bazel build --aarch64_linux_gnu_gcc_version="12.2.0" --host_platform=//:aarch64_linux_gnu_gcc-linux-x86_64 --platforms=//:linux-arm64 --toolchain_resolution_debug='.*' ...
INFO: Build option --toolchain_resolution_debug has changed, discarding analysis cache.
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64,
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64,
INFO: ToolchainResolution:   Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: Rejected toolchain //bazel/toolchain:clang-linux-x86_64; mismatching values: x86_64
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: Rejected toolchain //bazel/toolchain:gcc-linux-x86_64; mismatching values: x86_64
INFO: ToolchainResolution:   Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: Rejected toolchain //bazel/toolchain:clang-linux-x86_64; mismatching values: x86_64
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: target platform //:linux-arm64: Rejected toolchain //bazel/toolchain:gcc-linux-x86_64; mismatching values: x86_64
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64
INFO: ToolchainResolution: Target platform //:aarch64_linux_gnu_gcc-linux-x86_64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64,
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64,
INFO: ToolchainResolution:   Type @rules_foreign_cc//toolchains:m4_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc//toolchains:preinstalled_m4
INFO: ToolchainResolution:   Type @rules_foreign_cc//toolchains:automake_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc//toolchains:preinstalled_automake
INFO: ToolchainResolution: Target platform //:aarch64_linux_gnu_gcc-linux-x86_64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64,
INFO: ToolchainResolution:   Type @rules_foreign_cc//toolchains:pkgconfig_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc//toolchains:preinstalled_pkgconfig
INFO: ToolchainResolution:   Type @rules_foreign_cc//toolchains:make_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc//toolchains:preinstalled_make
INFO: ToolchainResolution:   Type @rules_foreign_cc//toolchains:autoconf_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc//toolchains:preinstalled_autoconf
INFO: ToolchainResolution:   Type @rules_foreign_cc//foreign_cc/private/framework:shell_toolchain: target platform //:linux-arm64: execution //:aarch64_linux_gnu_gcc-linux-x86_64: Selected toolchain @rules_foreign_cc_framework_toolchain_linux//:commands
INFO: ToolchainResolution: Target platform //:linux-arm64: Selected execution platform //:aarch64_linux_gnu_gcc-linux-x86_64, type @rules_foreign_cc//toolchains:autoconf_toolchain -> toolchain @rules_foreign_cc//toolchains:preinstalled_autoconf, type @rules_foreign_cc//toolchains:m4_toolchain -> toolchain @rules_foreign_cc//toolchains:preinstalled_m4, type @rules_foreign_cc//foreign_cc/private/framework:shell_toolchain -> toolchain @rules_foreign_cc_framework_toolchain_linux//:commands, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64, type @rules_foreign_cc//toolchains:pkgconfig_toolchain -> toolchain @rules_foreign_cc//toolchains:preinstalled_pkgconfig, type @rules_foreign_cc//toolchains:automake_toolchain -> toolchain @rules_foreign_cc//toolchains:preinstalled_automake, type @rules_foreign_cc//toolchains:make_toolchain -> toolchain @rules_foreign_cc//toolchains:preinstalled_make
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: target platform //:aarch64_linux_gnu_gcc-linux-x86_64: Rejected toolchain //bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64; mismatching values: arm64
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: execution platform //:aarch64_linux_gnu_gcc-linux-x86_64: Rejected toolchain //bazel/toolchain:clang-linux-x86_64; mismatching values: clang
INFO: ToolchainResolution:     Type @bazel_tools//tools/cpp:toolchain_type: execution platform //:aarch64_linux_gnu_gcc-linux-x86_64: Rejected toolchain //bazel/toolchain:gcc-linux-x86_64; mismatching values: gcc
INFO: ToolchainResolution:   Type @bazel_tools//tools/cpp:toolchain_type: target platform //:aarch64_linux_gnu_gcc-linux-x86_64: No toolchains found.
ERROR: /home/tlon/.cache/bazel/_bazel_tlon/d85bfd16708db53fe097086a278bf2d0/external/remote_coverage_tools/BUILD:9:12: While resolving toolchains for target @remote_coverage_tools//:Main: 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 '//pkg/noun:nock_tests' failed; build aborted:
INFO: Elapsed time: 0.271s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 1225 targets configu\
red)

Related

@mcevoypeter mcevoypeter added bug Something isn't working build Related to the build system labels Nov 10, 2022
@mcevoypeter
Copy link
Author

This is no longer an issue after #117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build Related to the build system
Projects
None yet
Development

No branches or pull requests

1 participant