Skip to content

Commit 6cd1239

Browse files
committed
Update toolchains for bazel 7
* rules_python -> 1.6.1, * rust toolchain -> 1.91, * python toolchain -> 3.11, * rules_cc -> 0.1.5, * rules_foreign_cc -> 0.15.1, * rules_rust -> 0.68.1 Signed-off-by: Matt Leon <[email protected]>
1 parent 82dc2b1 commit 6cd1239

File tree

11 files changed

+96
-46
lines changed

11 files changed

+96
-46
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ build:clang-tsan --test_env=TSAN_OPTIONS=suppressions=bazel/tsan_suppressions.tx
6060
# Use Clang-Tidy tool.
6161
build:clang-tidy --aspects //tools/lint:linters.bzl%clang_tidy
6262
build:clang-tidy --output_groups=rules_lint_report
63+
build:clang-tidy --config=hermetic-llvm
6364

6465
# Use GCC compiler.
6566
build:gcc --action_env=BAZEL_COMPILER=gcc

.github/workflows/format.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ jobs:
122122
steps:
123123
- uses: actions/checkout@v2
124124

125-
- name: Install dependencies (Linux)
126-
run: sudo apt update -y && sudo apt install -y clang-tidy-18 lld-18 && sudo ln -sf /usr/bin/lld-18 /usr/bin/lld
127-
128125
- name: set cache name
129126
id: vars
130127
# The cache tag consists of the following parts:
@@ -150,6 +147,7 @@ jobs:
150147
- name: Bazel build
151148
run: >
152149
bazel build
150+
--config=hermetic-llvm
153151
--config clang-tidy
154152
--define engine=multi
155153
--disk_cache /tmp/bazel/cache

.github/workflows/test.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
--test_output=errors
7777
--config=clang
7878
--disk_cache /tmp/bazel/cache
79+
--config=hermetic-llvm
7980
-c opt
8081
$(bazel query 'kind(was.*_rust_binary, //test/test_data/...)')
8182
$(bazel query 'kind(_optimized_wasm_cc_binary, //test/test_data/...)')
@@ -137,13 +138,13 @@ jobs:
137138
os: ubuntu-24.04-16core
138139
arch: x86_64
139140
action: test
140-
flags: --config=clang-asan --define=crypto=system
141+
flags: --config=hermetic-llvm --config=clang-asan --define=crypto=system
141142
- name: 'NullVM on Linux/x86_64 with TSan'
142143
engine: 'null'
143144
os: ubuntu-24.04-16core
144145
arch: x86_64
145146
action: test
146-
flags: --config=clang-tsan
147+
flags: --config=hermetic-llvm --config=clang-tsan
147148
- name: 'NullVM on Windows/x86_64'
148149
engine: 'null'
149150
os: windows-2022
@@ -205,20 +206,21 @@ jobs:
205206
os: ubuntu-24.04-16core
206207
arch: x86_64
207208
action: test
208-
flags: --config=clang
209+
flags: --config=hermetic-llvm
209210
- name: 'WAMR interp on macOS/x86_64'
210211
engine: 'wamr-interp'
211212
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
212213
os: macos-15
213214
arch: x86_64
214215
action: test
216+
flags: --config=hermetic-llvm-macos
215217
- name: 'WAMR jit on Linux/x86_64'
216218
engine: 'wamr-jit'
217219
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
218220
os: ubuntu-24.04-16core
219221
arch: x86_64
220222
action: test
221-
flags: --config=clang
223+
flags: --config=hermetic-llvm
222224
deps: lld-18
223225
cache: true
224226
- name: 'WAMR jit on macOS/x86_64'
@@ -228,33 +230,35 @@ jobs:
228230
arch: x86_64
229231
action: test
230232
cache: true
233+
flags: --config=hermetic-llvm-macos
231234
- name: 'WasmEdge on Linux/x86_64'
232235
engine: 'wasmedge'
233236
repo: 'com_github_wasmedge_wasmedge'
234237
os: ubuntu-24.04-16core
235238
arch: x86_64
236239
action: test
237-
flags: --config=clang
240+
flags: --config=hermetic-llvm
238241
- name: 'WasmEdge on macOS/x86_64'
239242
engine: 'wasmedge'
240243
repo: 'com_github_wasmedge_wasmedge'
241244
os: macos-15
242245
arch: x86_64
243246
action: test
247+
flags: --config=hermetic-llvm
244248
- name: 'Wasmtime on Linux/x86_64'
245249
engine: 'wasmtime'
246250
repo: 'com_github_bytecodealliance_wasmtime'
247251
os: ubuntu-24.04-16core
248252
arch: x86_64
249253
action: test
250-
flags: --config=clang -c opt
254+
flags: --config=hermetic-llvm -c opt
251255
- name: 'Wasmtime on Linux/x86_64 with ASan'
252256
engine: 'wasmtime'
253257
repo: 'com_github_bytecodealliance_wasmtime'
254258
os: ubuntu-24.04-16core
255259
arch: x86_64
256260
action: test
257-
flags: --config=clang-asan --define=crypto=system
261+
flags: --config=hermetic-llvm --config=clang-asan --define=crypto=system
258262
- name: 'Wasmtime on Linux/aarch64'
259263
engine: 'wasmtime'
260264
repo: 'com_github_bytecodealliance_wasmtime'
@@ -278,6 +282,7 @@ jobs:
278282
os: macos-15
279283
arch: x86_64
280284
action: test
285+
flags: --config=hermetic-llvm-macos
281286

282287
steps:
283288
- uses: actions/checkout@v2

bazel/dependencies.bzl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
1818
load("@envoy_toolshed//sysroot:sysroot.bzl", "setup_sysroots")
1919
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign/remote:crates.bzl", wasmsign_crate_repositories = "crate_repositories")
2020
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime/remote:crates.bzl", wasmtime_crate_repositories = "crate_repositories")
21-
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
21+
load("@rules_python//python:repositories.bzl", "py_repositories" )
2222
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
2323
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
2424
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
2525
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
26+
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
27+
load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps")
2628

2729
def proxy_wasm_cpp_host_dependencies():
2830
# Bazel extensions.
31+
googletest_deps()
32+
rules_foreign_cc_dependencies()
2933

3034
rules_lint_dependencies()
3135

3236
bazel_lib_dependencies()
3337
bazel_lib_register_toolchains()
3438

3539
py_repositories()
36-
python_register_toolchains(
37-
name = "python_3_9",
38-
python_version = "3.9",
39-
ignore_root_user_error = True, # for docker run
40-
)
4140

4241
rust_repositories()
4342
rust_repository_set(
@@ -46,18 +45,25 @@ def proxy_wasm_cpp_host_dependencies():
4645
extra_target_triples = [
4746
"aarch64-unknown-linux-gnu",
4847
"wasm32-unknown-unknown",
49-
"wasm32-wasi", # TODO: Change to wasm32-wasip1 once https://github.com/bazelbuild/rules_rust/issues/2782 is fixed
48+
"wasm32-wasip1",
5049
],
51-
versions = ["1.77.2"],
50+
versions = ["1.91.0"],
51+
sha256s = {
52+
"rustc-1.91.0-x86_64-unknown-linux-gnu.tar.xz": "a7169e8cb6174af2f45717703370363d8de82ce55f6ccba185893045b9370874",
53+
"clippy-1.91.0-x86_64-unknown-linux-gnu.tar.xz": "0087c3d58d2fdeafa89830c299b1026c9f981b49835db89c922b3c6a299b3225",
54+
"cargo-1.91.0-x86_64-unknown-linux-gnu.tar.xz": "7103c03fb8abe85b23307005a9dfe4f01c826a89945d84b96fa2d03fd4d2d138",
55+
"llvm-tools-1.91.0-x86_64-unknown-linux-gnu.tar.xz": "3d7756e0ce1ee18d20399aef770f09c55a4134f5a0f18e4e3c018aa1b3919a70",
56+
"rust-std-1.91.0-x86_64-unknown-linux-gnu.tar.xz": "89e6520b16c12b43526440298d2da0dcb70747c5cc2d0b8e47d39b5da9aeef49",
57+
},
5258
)
5359
rust_repository_set(
5460
name = "rust_linux_s390x",
5561
exec_triple = "s390x-unknown-linux-gnu",
5662
extra_target_triples = [
5763
"wasm32-unknown-unknown",
58-
"wasm32-wasi",
64+
"wasm32-wasip1",
5965
],
60-
versions = ["1.77.2"],
66+
versions = ["1.91.0"],
6167
)
6268
crate_universe_dependencies(bootstrap = True)
6369

bazel/dependencies_import.bzl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
1717
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
1818
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
1919
load("@v8_python_deps//:requirements.bzl", pip_v8_dependencies = "install_deps")
20+
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
21+
load("@bazel_features//:deps.bzl", "bazel_features_deps")
22+
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
2023

2124
def proxy_wasm_cpp_host_dependencies_import():
25+
python_register_toolchains(
26+
name = "python_3_11",
27+
python_version = "3.11",
28+
ignore_root_user_error = True, # for docker run
29+
)
30+
bazel_skylib_workspace()
31+
bazel_features_deps()
32+
2233
llvm_register_toolchains()
2334

24-
rules_foreign_cc_dependencies()
2535
rules_fuzzing_dependencies()
2636

2737
pip_fuzzing_dependencies()

bazel/external/rules_rust.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# https://github.com/bazelbuild/rules_rust/pull/1315
22

33
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
4-
index bfd96ed9..d7e38658 100644
4+
index f2fe58c2c..6e55c2c35 100644
55
--- a/rust/private/rustc.bzl
66
+++ b/rust/private/rustc.bzl
7-
@@ -1507,7 +1507,7 @@ def rustc_compile_action(
8-
})
9-
crate_info = rust_common.create_crate_info(**crate_info_dict)
10-
7+
@@ -1634,7 +1634,7 @@ def rustc_compile_action(
8+
**crate_info_dict
9+
)
10+
1111
- if crate_info.type in ["staticlib", "cdylib"]:
1212
+ if crate_info.type in ["staticlib", "cdylib"] and not out_binary:
1313
# These rules are not supposed to be depended on by other rust targets, and

bazel/external/wamr.patch

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index c33b211e..d04d0cc8 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -178,8 +178,6 @@ set (WAMR_PUBLIC_HEADERS
6+
)
7+
set_target_properties (vmlib PROPERTIES PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}")
8+
9+
-set_version_info (vmlib)
10+
-
11+
install (TARGETS vmlib
12+
EXPORT iwasmTargets
13+
LIBRARY DESTINATION lib
14+
diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake
15+
index cb15b8b0..b71cf077 100644
16+
--- a/build-scripts/config_common.cmake
17+
+++ b/build-scripts/config_common.cmake
18+
@@ -140,7 +140,7 @@ else ()
19+
endif ()
20+
21+
# Version
22+
-include (${WAMR_ROOT_DIR}/build-scripts/version.cmake)
23+
+# include (${WAMR_ROOT_DIR}/build-scripts/version.cmake)
24+
25+
# Package
26+
include (${WAMR_ROOT_DIR}/build-scripts/package.cmake)

bazel/external/wamr_llvm.BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ cmake(
5959
}),
6060
lib_source = ":srcs",
6161
out_data_dirs = [
62-
"bin",
63-
"include",
64-
"lib",
6562
"libexec",
6663
"share",
6764
],

bazel/repositories.bzl

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def proxy_wasm_cpp_host_repositories():
5151
maybe(
5252
http_archive,
5353
name = "rules_cc",
54-
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
55-
strip_prefix = "rules_cc-0.0.9",
56-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
54+
sha256 = "b8b918a85f9144c01f6cfe0f45e4f2838c7413961a8ff23bc0c6cdf8bb07a3b6",
55+
strip_prefix = "rules_cc-0.1.5",
56+
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.1.5/rules_cc-0.1.5.tar.gz",
5757
)
5858

5959
# aspect_rules_lint v1.12.0 for modern clang-tidy integration
@@ -113,9 +113,9 @@ def proxy_wasm_cpp_host_repositories():
113113
maybe(
114114
http_archive,
115115
name = "rules_foreign_cc",
116-
sha256 = "bcd0c5f46a49b85b384906daae41d277b3dc0ff27c7c752cc51e43048a58ec83",
117-
strip_prefix = "rules_foreign_cc-0.7.1",
118-
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.7.1.tar.gz",
116+
sha256 = "32759728913c376ba45b0116869b71b68b1c2ebf8f2bcf7b41222bc07b773d73",
117+
strip_prefix = "rules_foreign_cc-0.15.1",
118+
url = "https://github.com/bazel-contrib/rules_foreign_cc/releases/download/0.15.1/rules_foreign_cc-0.15.1.tar.gz",
119119
)
120120

121121
maybe(
@@ -129,17 +129,16 @@ def proxy_wasm_cpp_host_repositories():
129129
maybe(
130130
http_archive,
131131
name = "rules_python",
132-
sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
133-
strip_prefix = "rules_python-0.34.0",
134-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
132+
sha256 = "f2e80f97f9c0b82e2489e61e725df1e6bdaf16c4dacf5e26b95668787164baff",
133+
strip_prefix = "rules_python-1.6.1",
134+
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.6.1/rules_python-1.6.1.tar.gz",
135135
)
136136

137137
maybe(
138138
http_archive,
139139
name = "rules_rust",
140-
integrity = "sha256-JLN47ZcAbx9wEr5Jiib4HduZATGLiDgK7oUi/fvotzU=",
141-
# NOTE: Update Rust version in bazel/dependencies.bzl.
142-
url = "https://github.com/bazelbuild/rules_rust/releases/download/0.42.1/rules_rust-v0.42.1.tar.gz",
140+
integrity = "sha256-yKqAbPYGZnmsI0YyQe6ArWkiZdrQRl9RERy74wuJA1I=",
141+
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.68.1/rules_rust-0.68.1.tar.gz"],
143142
patches = ["@proxy_wasm_cpp_host//bazel/external:rules_rust.patch"],
144143
patch_args = ["-p1"],
145144
)
@@ -194,16 +193,22 @@ def proxy_wasm_cpp_host_repositories():
194193
sha256 = "65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c",
195194
strip_prefix = "googletest-1.17.0",
196195
urls = ["https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz"],
196+
repo_mapping = {
197+
"@abseil-cpp": "@com_google_absl",
198+
},
197199
)
198200

199201
# NullVM dependencies.
200202

201203
maybe(
202204
http_archive,
203205
name = "com_google_protobuf",
204-
sha256 = "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2",
205-
strip_prefix = "protobuf-3.17.3",
206-
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz",
206+
sha256 = "3d32940e975c4ad9b8ba69640e78f5527075bae33ca2890275bf26b853c0962c",
207+
strip_prefix = "protobuf-29.1",
208+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.1/protobuf-29.1.tar.gz",
209+
repo_mapping = {
210+
"@abseil-cpp": "@com_google_absl",
211+
},
207212
)
208213

209214
# V8 with dependencies.
@@ -301,6 +306,8 @@ def proxy_wasm_cpp_host_repositories():
301306
sha256 = "ca18bbf304f47287bf43707564db63b8908dd6d0d6ac40bb39271a7144def4cc",
302307
strip_prefix = "wasm-micro-runtime-WAMR-2.4.1",
303308
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-2.4.1.zip",
309+
patches = ["@proxy_wasm_cpp_host//bazel/external:wamr.patch"],
310+
patch_args = ["-p1"],
304311
)
305312

306313
maybe(

bazel/wasm.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _wasm_attrs(transition):
6464
"binary": attr.label(mandatory = True, cfg = transition),
6565
"signing_key": attr.label_list(allow_files = True),
6666
"_wasmsign_tool": attr.label(default = "//bazel/cargo/wasmsign/remote:wasmsign__wasmsign", executable = True, cfg = "exec"),
67-
"_whitelist_function_transition": attr.label(default = "@bazel_tools//tools/whitelists/function_transition_whitelist"),
67+
"_allowlist_function_transition": attr.label(default = "@bazel_tools//tools/allowlists/function_transition_allowlist"),
6868
}
6969

7070
wasm_rust_binary_rule = rule(

0 commit comments

Comments
 (0)