Skip to content

Windows build fails with unresolved xz reference #586

Description

@Sckorn

Hello, thank you, for youe amazing repo, that allows for a simple and convinient way of using libboost through Bazel.
Unfortunately, during the process of porting my project to Windows, I had experience a strange problem.
I added a dependency, according to readme, to my MODULES.bazel file. So now it looks like that:

###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

# Boost
# Famous C++ library that has given rise to many new additions to the C++ Standard Library
# Makes @boost available for use: For example, add `@boost//:algorithm` to your deps.
# For more, see https://github.com/nelhage/rules_boost and https://www.boost.org
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
archive_override(
    module_name = "rules_boost",
    urls = "https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz",
    strip_prefix = "rules_boost-master",
    # It is recommended to edit the above URL and the below sha256 to point to a specific version of this repository.
    # integrity = "sha256-...",
)

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
use_repo(
    non_module_boost_repositories,
    "boost",
)

After doing a bazel clean --expunge command, I try to recompile and run my target of interest, which is defined as follows:

cc_library(
    name = "parser",
    srcs = [...],
    hdrs = [...],
    includes = ["include"],
    strip_include_prefix = "include",
    visibility = ["//visibility:public"],
    deps = [
        "@boost//:property_tree",
    ],
)

cc_test(
    name = "parsers_tests",
    srcs = [...],
    copts = ["-Iexternal/gtest/include"],
    visibility = ["//visibility:public"],
    deps = [
        ":parser",
        "@com_google_googletest//:gtest_main",
    ],
)

with cli command bazel test --config=windows //parsers:parsers_tests.
As a result I'm getting the followinf error:

ERROR: no such package '@@xz~//': BUILD file not found in directory '' of external repository @@xz~. Add a BUILD file to a directory to mark it as a package.
ERROR: C:/users/user/_bazel_user/ygvlhio7/external/rules_boost~~non_module_dependencies~boost/BUILD.bazel:1128:14: no such package '@@xz~//': BUILD file not found in directory '' of external repository @@xz~. Add a BUILD file to a directory to mark it as a package. and referenced by '@@rules_boost~~non_module_dependencies~boost//:iostreams'
ERROR: Analysis of target '//parsers:parsers_tests' failed; build aborted: Analysis failed

My configuration:
OS - Windows 10 1909, build 18363.1440
Compiler - MSVC 17.0.1 (Visual Studio Community 2022)
Bazel - 7.1.2
If any more info is required, please reach out to me, I will provide it ASAP.
Thank everyone in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions