Repository navigation
[Cherry-pick][2.57.0][core][build] Drop -Wl,-pie from vendored RocksDB WITH_TSAN link flags (#64917) - #64937
Merged
Conversation
#64917) ## Why are these changes needed? The postmerge `:ray: core: cpp tsan tests` job has been red since #64759 (Jul 16). #64759 enabled `WITH_TSAN=ON` for the vendored RocksDB build (via `--define=ray_rocksdb_tsan=true` on `--config=tsan`) to get a TSan-instrumented `librocksdb.a`. However, RocksDB's `WITH_TSAN` block (CMakeLists.txt:373-378 in v10.6.2) does: ```cmake set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread -Wl,-pie") ``` `-Wl,-pie` passes `-pie` directly to the linker behind the compiler driver's back. Under the rules_foreign_cc crosstool (clang + static libc++ via `BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a`), the driver still emits non-PIE startup objects, so **every CMake `try_compile` probe fails to link**. Configure then aborts at the first `REQUIRED` check: ``` CMake Error at .../FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Threads (missing: Threads_FOUND) Call Stack (most recent call first): ... CMakeLists.txt:639 (find_package) ``` and six rocksdb-dependent test targets fail to build (`rocksdb_store_client_test`, `rocksdb_concurrency_test`, `rocksdb_parity_test`, `rocksdb_smoke_test`, `gcs_client_reconnection_test`, `global_state_accessor_test`). Every postmerge build since #64759 shows this failure (e.g. builds 18631, 18643, ... 18717); it wasn't caught premerge because the tsan job only runs postmerge. The tell in the configure log is that checks *before* the `WITH_TSAN` block (`HAVE_OMIT_LEAF_FRAME_POINTER`, `BUILTIN_ATOMIC`) pass, while every check *after* it fails — including trivial ones like `Looking for pthread.h - not found`. ### Fix Patch the vendored RocksDB archive to drop ` -Wl,-pie` from the `WITH_TSAN` linker flags. `-fsanitize=thread` is kept in both compile and link flags, so the library is still fully TSan-instrumented (the original goal of #64759). TSan does not require PIE with modern clang/gcc on x86_64/aarch64 Linux; when a driver does need PIE it adds it itself via `-fsanitize=thread` at link time. This only affects the `WITH_TSAN=ON` path (`--config=tsan`); regular builds use the non-TSAN cache entries and are untouched. ## Related issue number N/A — no issue filed for the postmerge breakage; this PR documents it. Root-caused from postmerge build logs (18631/18643/18717) and anyscale/rayturbo build 13564 which inherited the failure. ## Checks - Duplicate-work check: searched open PRs/issues for `tsan`/`rocksdb` — the most recent related change is #64759 itself; no open PR addresses this configure failure. - AI assistance was used to root-cause the CI failure and draft this change; a human (submitter) reviewed every line. - Local validation: - `patch -p1` applies cleanly to pristine rocksdb v10.6.2. - `bazel build @com_github_facebook_rocksdb//:rocksdb --define=ray_rocksdb_tsan=true` — with the patch, CMake configure proceeds past `find_package(Threads)` and the TSan-instrumented `librocksdb.a` builds (validated on Linux x86_64 with the gcc host toolchain; the exact CI failure mode is clang+static-libc++-specific — gcc defaults to PIE so `-Wl,-pie` is benign there — so the postmerge-config tsan CI job is the authoritative check). - The unpatched failure is reproduced by every postmerge tsan run since Jul 16 (identical `Could NOT find Threads` at CMakeLists.txt:639). - [ ] I've run scripts/format.sh to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests (existing cpp tsan test targets; this PR unblocks their build) - [ ] Release tests - [ ] This PR is not tested :( 🤖 Generated with [Claude Code](https://claude.com/claude-code) Postmerge run: https://buildkite.com/ray-project/postmerge/builds/18725/canvas Signed-off-by: elliot-barn <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> (cherry picked from commit 9ec3757) Signed-off-by: elliot-barn <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a patch to the RocksDB dependency in bazel/ray_deps_setup.bzl to resolve a build configuration issue when compiling with ThreadSanitizer (TSan). The patch (rocksdb-tsan-no-pie.patch) removes the -Wl,-pie flag from CMAKE_EXE_LINKER_FLAGS in RocksDB's CMake configuration, as this flag causes CMake's try_compile checks to fail under Ray's rules_foreign_cc toolchain (clang + static libc++). There are no review comments, and we have no additional feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #64917 (9ec3757) onto
releases/2.57.0. Clean cherry-pick, no conflicts.🤖 Generated with Claude Code