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_shared_library doesn't work with Bzlmod enabled #19822

Closed
Tracked by #19824
meteorcloudy opened this issue Oct 16, 2023 · 3 comments
Closed
Tracked by #19824

cc_shared_library doesn't work with Bzlmod enabled #19822

meteorcloudy opened this issue Oct 16, 2023 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: bug

Comments

@meteorcloudy
Copy link
Member

Description of the bug:

When Bzlmod is enabled, //src/main/starlark/tests/builtins_bzl:cc_builtin_tests fails with

ERROR: /usr/local/google/home/pcloudy/.cache/bazel/_bazel_pcloudy/4c5ccabacef1ddac6600d71a1b8bfa58/sandbox/linux-sandbox/3278/execroot/_main/_tmp/53b71ca53f550b44b438a63fa52d0916/workspace/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD:372:11: in path_matching_test_test rule //src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:path_matching_test:
Traceback (most recent call last):
	File "/usr/local/google/home/pcloudy/.cache/bazel/_bazel_pcloudy/4c5ccabacef1ddac6600d71a1b8bfa58/sandbox/linux-sandbox/3278/execroot/_main/_tmp/53b71ca53f550b44b438a63fa52d0916/root/6b43bf36e07619ef843bbf3707ed48d2/external/rules_testing/lib/analysis_test.bzl", line 196, column 13, in wrapped_impl
		impl(env, target)
	File "/usr/local/google/home/pcloudy/.cache/bazel/_bazel_pcloudy/4c5ccabacef1ddac6600d71a1b8bfa58/sandbox/linux-sandbox/3278/execroot/_main/_tmp/53b71ca53f550b44b438a63fa52d0916/workspace/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl", line 153, column 53, in _paths_test_impl
		env.expect.that_bool(_check_if_target_under_path(Label("@foo//foo"), Label("@bar//bar"))).equals(False)
	File "/usr/local/google/home/pcloudy/.cache/bazel/_bazel_pcloudy/4c5ccabacef1ddac6600d71a1b8bfa58/sandbox/linux-sandbox/3278/execroot/_main/_tmp/53b71ca53f550b44b438a63fa52d0916/workspace/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/starlark_tests.bzl", line 37, column 15, in _check_if_target_under_path
		if pattern.workspace_name != value.workspace_name:
Error: 'workspace_name' is not allowed on invalid Label @[unknown repo 'bar' requested from @]//bar:bar

Which category does this issue belong to?

C++/Objective-C Rules

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

To reproduce:

  • Remove disable_bzlmod from src/main/starlark/tests/builtins_bzl/cc_builtin_tests.sh
  • bazel test //src/main/starlark/tests/builtins_bzl:cc_builtin_tests

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

No response

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 master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

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

Discovered while turning on Bzlmod in shell tests: #19785

@meteorcloudy
Copy link
Member Author

@meteorcloudy
Copy link
Member Author

/cc @oquenchil @buildbreaker2021

@comius comius added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Oct 16, 2023
copybara-service bot pushed a commit that referenced this issue Oct 16, 2023
Bazel tests status:

- Bzlmod disabled:

  - AnalysisTestCase: to be migrated
  - ConfigurationTestCase: to be migrated
  - ConfigCommandTest: to be migrated, probably blocked by a bug

- Bzlmod enabled:

  - BuildViewTestCase: migrated at d51144c
  - Java integration tests migrated at 8d04711
  - Shell integration tests migrated at 175a18d (Bzlmod disabled in some tests)
  - Python integration tests migrated at 50c8375 (Bzlmod disabled in some tests)
  - BuildIntegrationTestCase: migrated in this change
  - Other Java unit tests migrated in this change

Issues identified:

- cc_shared_library doesn't work well with Bzlmod: #19822
- `bazel config` doesn't work well with Bzlmod: #19823

Fixes #18958

Tracking migration of remaining test cases in #19824

RELNOTES[INC]: Bzlmod is enabled by default, please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. Find more details at #18958

PiperOrigin-RevId: 573827480
Change-Id: I097b4bd7caafc996b034284ee688b8f3d2bca1f7
@iancha1992 iancha1992 removed this from the 7.0.0 release blockers milestone Oct 18, 2023
@iancha1992
Copy link
Member

@bazel-io fork 7.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

6 participants