Skip to content

invalid registered toolchain '@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain': No repository visible as '@rules_foreign_cc' from main repository #1239

@dmitry-j-mikhin

Description

@dmitry-j-mikhin

I have simple Bazel module
MODULE.bazel:

module(
    name = "libxml2",
    version = "2.13.3",
    compatibility_level = 1,
)
bazel_dep(name = "rules_foreign_cc", version = "0.11.1")

BUILD.bazel:

""" Builds libxml2.
"""

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

filegroup(
    name = "srcs",
    srcs = glob(["**"]),
)

cache_entries = {
    "CMAKE_POSITION_INDEPENDENT_CODE": "ON",
    "BUILD_SHARED_LIBS": "OFF",
    #libxml2 specific options.
    "LIBXML2_WITH_PYTHON": "OFF",
    "LIBXML2_WITH_LZMA": "OFF",
    "LIBXML2_WITH_TESTS": "OFF",
    "LIBXML2_WITH_PROGRAMS": "OFF",
}

cmake(
    name = "libxml2",
    env = {"CMAKE_BUILD_TYPE": "Release"},
    lib_source = ":srcs",
    cache_entries = cache_entries,
    out_include_dir = "include/libxml2",
    visibility = ["//visibility:public"],
)

This module compiles successfully on Linux and macOS. But on Windows the following error occurs:

bazel --output_user_root=C:/b build --show_progress_rate_limit=5 --curses=yes --color=yes --terminal_columns=143 --show_timestamps --verbose_failures --jobs=30 --announce_rc --experimental_repository_cache_hardlinks --disk_cache= --remote_cache=remotebuildexecution.googleapis.com --remote_instance_name=projects/bazel-untrusted/instances/default_instance --google_default_credentials --bes_backend=buildeventservice.googleapis.com --bes_timeout=360s --project_id=bazel-untrusted --remote_timeout=60 --remote_max_connections=200 --remote_default_platform_properties=properties:{name:"cache-silo-key" value:"1d5ec805093884c76b310cf26aeb82ee568b9359f72bef33e0bc82eff4360c80"} --remote_download_toplevel --test_env=LocalAppData --test_env=BAZELISK_USER_AGENT --test_env=USE_BAZEL_VERSION -- @libxml2//:libxml2
(16:48:01) WARNING: Option 'project_id' is deprecated: Use --bes_instance_name instead
(16:48:01) WARNING: Option 'remote_default_platform_properties' is deprecated: --remote_default_platform_properties has been deprecated in favor of --remote_default_exec_properties.
(16:48:01) INFO: Invocation ID: 0f7cc2aa-16f9-4098-a3fb-4d089a40eca6
(16:48:01) INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
(16:48:01) INFO: Options provided by the client:
  'build' options: --python_path=C:/python3/python.exe
(16:48:01) INFO: Reading rc options for 'build' from c:\b\bk-windows-326v\bazel-org-repo-root\.bazelrc:
  'build' options: --experimental_enable_bzlmod --registry=file:///c:/b/bk-windows-326v/bazel/bcr-presubmit
(16:48:01) INFO: Current date is 2024-07-30
(16:48:01) WARNING: Option 'project_id' is deprecated: Use --bes_instance_name instead
(16:48:01) WARNING: Option 'remote_default_platform_properties' is deprecated: --remote_default_platform_properties has been deprecated in favor of --remote_default_exec_properties.
(16:48:12) ERROR: C:/b/wd2wermq/external/rules_foreign_cc~/toolchains/private/BUILD.bazel:158:15: While resolving toolchains for target @@rules_foreign_cc~//toolchains/private:pkgconfig_tool_msvc_build_ (538d53d): invalid registered toolchain '@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain': No repository visible as '@rules_foreign_cc' from main repository
(16:48:12) ERROR: Analysis of target '@@libxml2~//:libxml2' failed; build aborted: Analysis failed
(16:48:12) INFO: Elapsed time: 11.979s, Critical Path: 0.05s
(16:48:12) INFO: 1 process: 1 internal.
(16:48:12) ERROR: Build did NOT complete successfully
(16:48:12) FAILED:
    Fetching repository @@rules_foreign_cc~~tools~cmake-3.23.2-windows-x86_64; starting 5s
    Fetching C:/b/wd2wermq/external/rules_foreign_cc~~tools~cmake-3.23.2-windows-x86_64; Extracting cmake-3.23.2-windows-x86_64.zip 4s
bazel build failed with exit code 1
🚨 Error: The command exited with status 1
user command error: exit status 1

Full logs are available here - https://buildkite.com/bazel/bcr-presubmit/builds/6949#0191048a-50a6-4826-8e5c-68d888cca6f1
Related discussion in BCR - bazelbuild/bazel-central-registry#2512

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions