Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci-rbe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ jobs:
name: All RBE tests
cache-save: ${{ github.ref_name == 'trunk' }}
rerun-with-debug: true
ruby-version: jruby-10.1.0.0
run: ./scripts/github-actions/ci-build.sh ${{ github.event.inputs.disable_test_cache }}
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ bazel_dep(name = "rules_oci", version = "2.3.0")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "rules_python", version = "1.9.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_ruby", version = "0.26.0")
bazel_dep(name = "rules_rs", version = "0.0.90")
bazel_dep(name = "rules_ruby", version = "0.27.0")

single_version_override(
module_name = "rules_jvm_external",
Expand Down
2 changes: 1 addition & 1 deletion common/remote-build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ platform(
"@llvm//constraints/libc:gnu.2.28",
],
exec_properties = {
"container-image": "docker://docker.io/selenium/selenium-remote-build@sha256:ca164352826812f02eaa1b4dab89adcf5b3e57deb6798dd9f15d004099db59fe",
"container-image": "docker://docker.io/selenium/selenium-remote-build@sha256:7f917a409785aceff81e72358222c6d1bdc24d0b7df2d02f0f46e7392d5c8871",
"OSFamily": "Linux",
"dockerNetwork": "standard", # Allow internet access for the Rust tests
"dockerReuse": "True",
Expand Down
64 changes: 54 additions & 10 deletions common/remote-build/cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,32 @@
# This becomes the BUILD file for @local_config_cc// under non-BSD unixes.

load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")
load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
load("@rules_cc//cc/toolchains:cc_toolchain_suite.bzl", "cc_toolchain_suite")
load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config")
load(":cc_toolchain_config.bzl", "cc_toolchain_config")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

cc_library(name = "empty_lib")

# Label flag for extra libraries to be linked into every binary.
label_flag(
name = "link_extra_libs",
build_setting_default = ":empty_lib",
)

# The final extra library to be linked into every binary target. This collects
# the above flag, but may also include more libraries depending on config.
cc_library(
name = "link_extra_lib",
deps = [
":link_extra_libs",
],
)
Comment on lines +27 to +42

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.

Action required

3. Build setting in deps 🐞 Bug ≡ Correctness

//common/remote-build/cc:link_extra_lib is a cc_library that lists :link_extra_libs in deps,
but :link_extra_libs is a label_flag build setting rather than a C/C++ provider. This is likely
to fail analysis when building the generated toolchain repo (e.g., during `bazel build
@local_config_cc//...`).
Agent Prompt
## Issue description
`cc_library(name = "link_extra_lib")` depends directly on `:link_extra_libs`, but `:link_extra_libs` is a `label_flag` build setting (not a C/C++ library target). This wiring is very likely to break Bazel analysis for targets that evaluate `//common/remote-build/cc:link_extra_lib`.

## Issue Context
This directory is generated/copied as part of toolchain regeneration and is intended to be buildable.

## Fix Focus Areas
- common/remote-build/cc/BUILD[27-42]
- scripts/remote-image/create-cc-toolchain-within-image.sh[14-27]

## What to change
- Make `//common/remote-build/cc:link_extra_lib` depend only on real `cc_library` targets (e.g., `:empty_lib`) OR remove `link_extra_lib` entirely if unused.
- If the intent is to make a build-setting-controlled library available to toolchain logic, implement an explicit Starlark rule/macro that reads the build setting value and forwards the referenced target’s `CcInfo` (instead of placing the `label_flag` target itself in `deps`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


cc_library(
name = "malloc",
)
Expand All @@ -37,12 +55,27 @@ filegroup(
srcs = ["cc_wrapper.sh"],
)

filegroup(
name = "validate_static_library",
srcs = ["validate_static_library.sh"],
)

filegroup(
name = "deps_scanner_wrapper",
srcs = ["deps_scanner_wrapper.sh"],
)

filegroup(
name = "compiler_deps",
srcs = glob(
["extra_tools/**"],
allow_empty = True,
) + [":builtin_include_directory_paths"],
) + [
":builtin_include_directory_paths",
":cc_wrapper",
":deps_scanner_wrapper",
":validate_static_library",
],
)

# This is the entry point for --crosstool_top. Toolchains are found
Expand All @@ -69,6 +102,7 @@ cc_toolchain(
module_map = None,
objcopy_files = ":empty",
strip_files = ":empty",
supports_header_parsing = 1,
supports_param_files = 1,
toolchain_config = ":local",
toolchain_identifier = "local",
Expand All @@ -78,6 +112,7 @@ cc_toolchain_config(
name = "local",
abi_libc_version = "local",
abi_version = "local",
all_compile_flags = [],
compile_flags = [
"-fstack-protector",
"-Wall",
Expand All @@ -86,31 +121,38 @@ cc_toolchain_config(
"-fno-omit-frame-pointer",
],
compiler = "gcc",
conly_flags = [],
coverage_compile_flags = ["--coverage"],
coverage_link_flags = ["--coverage"],
cpu = "k8",
cxx_builtin_include_directories = [
"/usr/lib/gcc/x86_64-linux-gnu/9/include",
"/usr/lib/gcc/x86_64-linux-gnu/11/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"/usr/include/c++/9",
"/usr/include/x86_64-linux-gnu/c++/9",
"/usr/include/c++/9/backward",
"/usr/include/c++/11",
"/usr/include/x86_64-linux-gnu/c++/11",
"/usr/include/c++/11/backward",
],
cxx_flags = ["-std=c++0x"],
cxx_flags = ["-std=c++17"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we're setting this here, I think we can remove the equivalent entries in the .bazelrc. Can be done in a follow up PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, isn't this file only enabled on RBE, while .bazelrc is enabled for everything?

dbg_compile_flags = ["-g"],
extra_flags_per_feature = {},
fastbuild_compile_flags = [],
host_system_name = "local",
link_flags = [
"-fuse-ld=gold",
"-B/usr/bin",
"-Wl,-no-as-needed",
"-Wl,-z,relro,-z,now",
"-B/usr/bin",
"-pass-exit-codes",
],
link_libs = [
"-Wl,--push-state,-as-needed",
"-lstdc++",
"-Wl,--pop-state",
"-Wl,--push-state,-as-needed",
"-lm",
"-Wl,--pop-state",
],
opt_compile_flags = [
"-g0",
Expand All @@ -127,8 +169,6 @@ cc_toolchain_config(
tool_paths = {
"ar": "/usr/bin/ar",
"ld": "/usr/bin/ld",
"llvm-cov": "None",
"llvm-profdata": "None",
"cpp": "/usr/bin/cpp",
"gcc": "/usr/bin/gcc",
"dwp": "/usr/bin/dwp",
Expand All @@ -137,6 +177,10 @@ cc_toolchain_config(
"objcopy": "/usr/bin/objcopy",
"objdump": "/usr/bin/objdump",
"strip": "/usr/bin/strip",
"c++filt": "/usr/bin/c++filt",
"cpp-module-deps-scanner": "deps_scanner_wrapper.sh",
"parse_headers": "cc_wrapper.sh",
"validate_static_library": "validate_static_library.sh",
},
toolchain_identifier = "local",
unfiltered_compile_flags = [
Expand Down
Empty file.
2 changes: 0 additions & 2 deletions common/remote-build/cc/WORKSPACE

This file was deleted.

5 changes: 3 additions & 2 deletions common/remote-build/cc/armeabi_cc_toolchain_config.bzl
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"""A Starlark cc_toolchain configuration rule"""

load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"@rules_cc//cc:cc_toolchain_config_lib.bzl",
"feature",
"tool_path",
)
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/private/toolchain_config:cc_toolchain_config_info.bzl", "CcToolchainConfigInfo")
load("@rules_cc//cc/toolchains:cc_toolchain_config_info.bzl", "CcToolchainConfigInfo")

def _impl(ctx):
toolchain_identifier = "stub_armeabi-v7a"
Expand All @@ -45,6 +45,7 @@ def _impl(ctx):

tool_paths = [
tool_path(name = "ar", path = "/bin/false"),
tool_path(name = "compat-ld", path = "/bin/false"),
tool_path(name = "cpp", path = "/bin/false"),
tool_path(name = "dwp", path = "/bin/false"),
tool_path(name = "gcc", path = "/bin/false"),
Expand Down
8 changes: 4 additions & 4 deletions common/remote-build/cc/builtin_include_directory_paths
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ changes to it will be reflected in the action cache key. When some of these
paths change, Bazel will make sure to rerun the action, even though none of
declared action inputs or the action commandline changes.

/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/lib/gcc/x86_64-linux-gnu/11/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
/usr/include/c++/9
/usr/include/x86_64-linux-gnu/c++/9
/usr/include/c++/9/backward
/usr/include/c++/11
/usr/include/x86_64-linux-gnu/c++/11
/usr/include/c++/11/backward
Loading
Loading