bazelbuild/bazel

Using Bazel on Windows for compiling a local target that has a dependency on a target located in the network location

Open

#28607 opened on Feb 10, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (25,384 stars) (4,465 forks)batch import
P2area-Windowshelp wantedteam-OSStype: bug

Description

Description of the bug:

I plan to use a module that physically lives on a mapped network drive and is consumed by a local module, producing and linking a static C++ library.

Here is the setup for my experiment:

Directory Structures for the local and network modules

C:\bazel_local_module\
├── MODULE.bazel
├── BUILD.bazel
└── main.cc
Z:\bazel_network_module\
├── MODULE.bazel
├── BUILD.bazel
├── include\
│   └── network_lib.h
└── src\
    └── network_lib.cc

Local Module

C:\bazel_local_module\MODULE.bazel

module(
    name = "local_app",
    version = "1.0.0",
)

bazel_dep(
    name = "network_lib",
    version = "1.0.0",
)

local_path_override(
    module_name = "network_lib",
    path = "Z:/bazel_network_module",
)

C:\bazel_local_module\BUILD.bazel

cc_binary(
    name = "local_app",
    srcs = ["main.cpp"],
    deps = [
        "@network_lib//:network_lib",
    ],
)

C:\bazel_local_module\main.cpp

#include <iostream>
#include "network_lib.h"

int main() {
    std::cout << network_message() << std::endl;
    return 0;
}

Network Module

Z:\bazel_network_module\MODULE.bazel

module(
    name = "network_lib",
    version = "1.0.0",
)

Z:\bazel_network_module\BUILD.bazel

cc_library(
    name = "network_lib",
    srcs = ["src/network_lib.cc"],
    hdrs = ["include/network_lib.h"],
    includes = ["include"], 
    visibility = ["//visibility:public"],
)

Z:\bazel_network_module\include\network_lib.h

#pragma once

const char* network_message();

Z:\bazel_network_module\src\network_lib.cc

#include "network_lib.h"

const char* network_message() {
    return "Hello from the network drive static library!";
}

Why do I face the following error with this setup? How can I further debug this failure?

C:\bazel_local_module>bazel shutdown

C:\bazel_local_module>bazel clean --expunge
Starting local Bazel server (9.0.0) and connecting to it...
INFO: Starting clean.

C:\bazel_local_module>bazel build //:local_app --sandbox_debug --subcommands
Starting local Bazel server (9.0.0) and connecting to it...
ERROR: fetching network_lib+: java.io.IOException: network_lib+ must create a directory
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: network_lib+ must create a directory
Computing main repo mapping:

Which category does this issue belong to?

Remote Execution

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Reproduction steps are shared in the bug description.

Which operating system are you running Bazel on?

Windows 11

What is the output of bazel info release?

release 9.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

I am using the win64 executable installed from bazel/releases.

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Contributor guide