-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[bazel] fix libc build #119433
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
[bazel] fix libc build #119433
Conversation
bd6f1e0
to
80bd089
Compare
@llvm/pr-subscribers-libc Author: Nick Desaulniers (nickdesaulniers) Changes
Full diff: https://github.com/llvm/llvm-project/pull/119433.diff 6 Files Affected:
diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc
index 2628352f5162b6..3a49d4e0898c0c 100644
--- a/utils/bazel/.bazelrc
+++ b/utils/bazel/.bazelrc
@@ -9,7 +9,7 @@
# Flip off to disable MODULE.bazel until we're ready.
# https://github.com/llvm/llvm-project/issues/55924
-common --enable_bzlmod=false
+common --enable_bzlmod=false --enable_workspace
# Prevent invalid caching if input files are modified during a build.
build --experimental_guard_against_concurrent_changes
diff --git a/utils/bazel/.bazelversion b/utils/bazel/.bazelversion
index 1502020768a7b4..ae9a76b9249ada 100644
--- a/utils/bazel/.bazelversion
+++ b/utils/bazel/.bazelversion
@@ -1 +1 @@
-7.3.0
+8.0.0
diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE
index 66ba1ac1b17e1e..b24dfd17afcd2c 100644
--- a/utils/bazel/WORKSPACE
+++ b/utils/bazel/WORKSPACE
@@ -16,6 +16,14 @@ http_archive(
],
)
+# https://github.com/bazelbuild/rules_cc/releases/tag/0.0.17
+http_archive(
+ name = "rules_cc",
+ urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
+ sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
+ strip_prefix = "rules_cc-0.0.17",
+)
+
new_local_repository(
name = "llvm-raw",
build_file_content = "# empty",
@@ -29,9 +37,9 @@ llvm_configure(name = "llvm-project")
maybe(
http_archive,
name = "rules_python",
- sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
- strip_prefix = "rules_python-0.34.0",
- url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
+ sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
+ strip_prefix = "rules_python-1.0.0",
+ url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
)
maybe(
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5fea4449e1b9ed..5331a0409d2a25 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3708,8 +3708,8 @@ libc_function(
libc_function(
name = "bcopy",
- srcs = ["src/string/bcopy.cpp"],
- hdrs = ["src/string/bcopy.h"],
+ srcs = ["src/strings/bcopy.cpp"],
+ hdrs = ["src/strings/bcopy.h"],
features = no_sanitize_features,
deps = [
":__support_common",
@@ -3732,8 +3732,8 @@ libc_function(
libc_function(
name = "bcmp",
- srcs = ["src/string/bcmp.cpp"],
- hdrs = ["src/string/bcmp.h"],
+ srcs = ["src/strings/bcmp.cpp"],
+ hdrs = ["src/strings/bcmp.h"],
features = no_sanitize_features,
weak = True,
deps = [
@@ -3744,8 +3744,8 @@ libc_function(
libc_function(
name = "bzero",
- srcs = ["src/string/bzero.cpp"],
- hdrs = ["src/string/bzero.h"],
+ srcs = ["src/strings/bzero.cpp"],
+ hdrs = ["src/strings/bzero.h"],
features = no_sanitize_features,
weak = True,
deps = [
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
index b11bf163473be1..a31c67cfcea80c 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
@@ -184,19 +184,6 @@ libc_test(
],
)
-libc_test(
- name = "bcopy_test",
- srcs = ["bcopy_test.cpp"],
- libc_function_deps = [
- "//libc:bcopy",
- ],
- deps = [
- ":memory_check_utils",
- "//libc:__support_cpp_span",
- "//libc/test/UnitTest:memory_matcher",
- ],
-)
-
libc_test(
name = "memcmp_test",
srcs = ["memcmp_test.cpp"],
@@ -208,24 +195,3 @@ libc_test(
"//libc/test/UnitTest:test_logger",
],
)
-
-libc_test(
- name = "bcmp_test",
- srcs = ["bcmp_test.cpp"],
- libc_function_deps = [
- "//libc:bcmp",
- ],
- deps = [
- ":memory_check_utils",
- "//libc/test/UnitTest:test_logger",
- ],
-)
-
-libc_test(
- name = "bzero_test",
- srcs = ["bzero_test.cpp"],
- libc_function_deps = [
- "//libc:bzero",
- ],
- deps = [":memory_check_utils"],
-)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
new file mode 100644
index 00000000000000..985887e7183178
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
@@ -0,0 +1,60 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# Tests for LLVM libc string.h functions.
+
+load("//libc:libc_build_rules.bzl", "libc_support_library")
+load("//libc/test:libc_test_rules.bzl", "libc_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+# libc_support_library(
+# name = "memory_check_utils",
+# hdrs = ["memory_utils/memory_check_utils.h"],
+# deps = [
+# "//libc:__support_cpp_span",
+# "//libc:__support_libc_assert",
+# "//libc:__support_macros_config",
+# "//libc:__support_macros_sanitizer",
+# "//libc:string_memory_utils",
+# ],
+# )
+
+libc_test(
+ name = "bcopy_test",
+ srcs = ["bcopy_test.cpp"],
+ libc_function_deps = [
+ "//libc:bcopy",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ "//libc:__support_cpp_span",
+ "//libc/test/UnitTest:memory_matcher",
+ ],
+)
+
+libc_test(
+ name = "bcmp_test",
+ srcs = ["bcmp_test.cpp"],
+ libc_function_deps = [
+ "//libc:bcmp",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ "//libc/test/UnitTest:test_logger",
+ ],
+)
+
+libc_test(
+ name = "bzero_test",
+ srcs = ["bzero_test.cpp"],
+ libc_function_deps = [
+ "//libc:bzero",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ ],
+)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUILD change looks good, i would probably land that first and wait for CI since who knows what else might break with bazel 8.x
80bd089
to
3d025d2
Compare
"//libc:bcopy", | ||
], | ||
deps = [ | ||
"//libc/test/string:memory_check_utils", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite right, not sure the correct incantation:
ERROR: no such package '@@llvm-project//libc/test/string': BUILD file not found in directory 'libc/test/string' of external repository @@llvm-project. Add a BUILD file to a directory to mark it as a package.
ERROR: /usr/local/google/home/ndesaulniers/.cache/bazel/_bazel_ndesaulniers/02cf1b716d72de9bb7498bab3b083b83/external/llvm-project/libc/test/src/strings/BUILD.bazel:39:10: no such package '@@llvm-project//libc/test/string': BUILD file not found in directory 'libc/test/string' of external repository @@llvm-project. Add a BUILD file to a directory to mark it as a package. and referenced by '@@llvm-project//libc/test/src/strings:bcmp_test'
ERROR: Analysis of target '@@llvm-project//libc/test/src/strings:bcmp_test' failed; build aborted: Analysis failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
Outdated
Show resolved
Hide resolved
Going for lunch, will merge after. carte blanche to merge sooner otherwise. |
Link: #118899