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

Incorrect visibility rule breaks remote builds on Windows #4883

Closed
jasharpe opened this issue Mar 20, 2018 · 2 comments
Closed

Incorrect visibility rule breaks remote builds on Windows #4883

jasharpe opened this issue Mar 20, 2018 · 2 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: windows type: bug

Comments

@jasharpe
Copy link

jasharpe commented Mar 20, 2018

Description of the problem / feature request:

On Windows, building a C++ Hello World program with --define=EXECUTOR=remote fails with a visibility problem.

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

The WORKSPACE is empty.

Here's the exact command I'm running:

bazel build --define=EXECUTOR=remote :hello

Here's my BUILD file:

cc_binary(
    name = "hello",
    srcs = ["hello.cc"],
)

Here's my hello.cc:

#include <ctime>
#include <string>
#include <iostream>

std::string get_greet(const std::string& who) {
  return "Hello " + who;
}

void print_localtime() {
  std::time_t result = std::time(nullptr);
  std::cout << std::asctime(std::localtime(&result));
}

int main(int argc, char** argv) {
  std::string who = "world";
  if (argc > 1) {
    who = argv[1];
  }
  std::cout << get_greet(who) << std::endl;
  print_localtime();
  return 0;
}

Here's the output I get:

ERROR: <redacted>/external/bazel_tools/tools/def_parser/BUILD:3:1: Target '@bazel_tools//third_party/def_parser:def_parser' is not visible from target '@bazel_tools//tools/def_parser:def_parser_windows'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//:hello' failed; build aborted: Analysis of target '@bazel_tools//tools/def_parser:def_parser_windows' failed; build aborted
INFO: Elapsed time: 0.348s
FAILED: Build did NOT complete successfully (0 packages loaded)

What operating system are you running Bazel on?

Windows Server 2016

What's the output of bazel info release?

release 0.11.1

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

N/A

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

N/A

Have you found anything relevant by searching the web?

No.

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

The problem is this BUILD rule dependency: https://github.com/bazelbuild/bazel/blob/master/tools/def_parser/BUILD.tools#L6

The visibility of the depended on rule does not include tools/def_parser: https://github.com/bazelbuild/bazel/blob/master/third_party/def_parser/BUILD#L13

The use of this rule is triggered by --define=EXECUTOR=remote when building C++ on Windows (--cpu=x64_windows).

@jasharpe
Copy link
Author

Workaround is using --nocheck_visibility on builds affected by this.

meteorcloudy added a commit to meteorcloudy/bazel that referenced this issue Mar 20, 2018
bazelbuild#4883

Change-Id: I23257cbde6f24df2b7af27c5ce37281202651ed1
bazel-io pushed a commit that referenced this issue Mar 20, 2018
#4883

Change-Id: I23257cbde6f24df2b7af27c5ce37281202651ed1
philwo pushed a commit that referenced this issue Mar 21, 2018
#4883

Change-Id: I23257cbde6f24df2b7af27c5ce37281202651ed1
@hlopko hlopko added type: bug P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: windows labels Mar 21, 2018
@meteorcloudy
Copy link
Member

This is fixed.

philwo pushed a commit that referenced this issue Apr 9, 2018
#4883

Change-Id: I23257cbde6f24df2b7af27c5ce37281202651ed1
philwo pushed a commit that referenced this issue Apr 11, 2018
#4883

Change-Id: I23257cbde6f24df2b7af27c5ce37281202651ed1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: windows type: bug
Projects
None yet
Development

No branches or pull requests

3 participants