Skip to content

[rust] Allow cross-compilation of selenium-manager on all platforms#17427

Draft
shs96c wants to merge 2 commits intoSeleniumHQ:trunkfrom
shs96c:build-selenium-manager
Draft

[rust] Allow cross-compilation of selenium-manager on all platforms#17427
shs96c wants to merge 2 commits intoSeleniumHQ:trunkfrom
shs96c:build-selenium-manager

Conversation

@shs96c
Copy link
Copy Markdown
Member

@shs96c shs96c commented May 8, 2026

No description provided.

@selenium-ci selenium-ci added C-py Python Bindings C-rb Ruby Bindings C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations C-rust Rust code is mostly Selenium Manager B-manager Selenium Manager labels May 8, 2026
Comment thread MODULE.bazel
# Register Windows + macOS + Linux execs so the per-platform Selenium
# Manager variants in //rust can be cross-compiled on any developer host
# and on RBE.
llvm_toolchains = use_extension("@llvm//extensions:toolchain.bzl", "toolchain")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can actually snip this entire extension and its configuration, just do register_toolchains("@llvm//toolchain:all"). I only did this to scope down what i was registering to avoid messing with the other platforms :)

Comment thread MODULE.bazel
crate = "windows-targets",
patch_args = ["-p1"],
patches = ["//third_party/bazel:windows_targets_readme_case.patch"],
# Only the 0.53 line has this case mismatch; 0.52.x ships a lowercase
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, they regressed it? wild

Comment thread rust/BUILD.bazel
# Each (OS, arch) variant cross-compiles directly via rules_rs
#
# Linux targets use musl rather than glibc because Rust's prebuilt glibc
# stdlib hard-references `-lgcc_s`, which the @llvm toolchain doesn't ship.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw this can be made to work by passing --@llvm//config:experimental_stub_libgcc_s=True flag (which we will actually enable by default I think) but it's probably still nicer to ship a statically-linked musl variant and not worry about glibc versioning

Comment thread rust/BUILD.bazel
# musl produces a fully self-contained binary that runs on any Linux
# distribution.
#
# Windows targets use the LLVM-based MinGW (gnullvm) ABI rather than MSVC
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also have in-flight work to allow shipping fully-hermetic MSVC variants as well, it requires patching rules_cc and llvm though. Just mentioning in case you prefer that route, see https://github.com/hermeticbuild/toml2json/blob/master/MODULE.bazel#L8-L76

(we're going to make those hashes part of defaults/etc when this is ready to ship for real)

Comment thread rust/BUILD.bazel
@@ -1,3 +1,6 @@
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this module got renamed to bazel_lib as part of 3.0. Not sure if yall are using both already or still need to migrate

Comment thread rb/BUILD.bazel
name = "manager-windows",
src = "//common/manager:selenium-manager-windows",
out = "bin/windows/selenium-manager.exe",
copy_directory(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if it might make sense to turn that bundle rule into a macro that can be invoked in each language package, that might prevent some directory copies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-manager Selenium Manager C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings C-rust Rust code is mostly Selenium Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants