Skip to content
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

Local remote toolchains don't work with rules_rust #477

Closed
aaronmondal opened this issue Dec 12, 2023 · 4 comments
Closed

Local remote toolchains don't work with rules_rust #477

aaronmondal opened this issue Dec 12, 2023 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@aaronmondal
Copy link
Member

This is due to rules_rust handling compilers and linkers slightly differently than rules_cc. We probably need to fix this upstream.

@aaronmondal aaronmondal added bug Something isn't working enhancement New feature or request labels Dec 12, 2023
@aaronmondal aaronmondal self-assigned this Dec 12, 2023
@adam-singer
Copy link
Contributor

This might be related to the issues I've been seeing with running on osx rbe https://gist.github.com/adam-singer/454091259e457f9db22a1555491afee1

From what I observe SYSROOT is pointing to the rust toolchain which contains what we would expect https://gist.github.com/adam-singer/1f4cff04263bba686d9665eec1777f42#file-gistfile0-txt-L24 bin/ lib/

Looking back at the linker issue from https://gist.github.com/adam-singer/454091259e457f9db22a1555491afee1

/private/tmp/native_link/data-worker-test/content_path-cas/../lib/librustc_driver-ba55eb73d0d2fe7a.dylib' (no such file), '/private/tmp/native_link/data-worker-test/content_path-cas/../lib/librustc_driver-ba55eb73d0d2fe7a.dylib' (no such file), '/usr/local/lib/librustc_driver-ba55eb73d0d2fe7a.dylib' (no such file), '/usr/lib/librustc_driver-ba55eb73d0d2fe7a.dylib' (no such file, not in dyld cache)

Which seems to indicate that the process-wrapper or underlying rustc tried to do some LD_LIBRARY_PATH / DYLD_LIBRARY_PATH path resolution. Not uncommon for linkers to have some "standard" path search.

I think what is happening is the way the process-wrapper passes SYSROOT and somehow sets a root environment of sorts, rustc tries to look back from bin and then to lib with ../lib, making the assumption that rust's core libraries are always the same level as the bin folder.

@aaronmondal
Copy link
Member Author

aaronmondal commented Dec 13, 2023

Potentially relevant is that the latest release from a few hours ago included changes to sysroot.

https://github.com/bazelbuild/rules_rust/releases/tag/0.33.0

The darwin issue seems indeed very similar to the issues on linux. Enabling the --incompatible_enable_cc_toolchain_resultion triggers this error: serde-rs/serde#2322 and breaks a bunch of macro resolutions that point to toolchain misconfiguration or some issue with the dynamic linker and/or glibc: https://gist.github.com/aaronmondal/a2f8caf3c20cfec0dc986057e5e2020f

@adam-singer
Copy link
Contributor

Filed a ticket with rules_rust bazelbuild/rules_rust#2331, maybe there is an existing work around, otherwise we can complete the patch. Hooking the ld lib path usually isn't ideal, rules_rust has so many flags and settings, wasn't sure would be the right one to flip.

aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 23, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

- Update custom stdenv to use Clang/LLVM 18
- Regenerate LRE toolchains.
- Remove obsolete zig_cc toolchain
- Expand LRE CI to build C++ parts of NativeLink remotely in K8s and the
  rest of rules_rust locally.

Fixes TraceMachina#694
Closes TraceMachina#477
aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 23, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

- Update custom stdenv to use Clang/LLVM 18
- Regenerate LRE toolchains.
- Remove obsolete zig_cc toolchain
- Expand LRE CI to build C++ parts of NativeLink remotely in K8s and the
  rest of rules_rust locally.

Fixes TraceMachina#694
Closes TraceMachina#477
aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 23, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

- Update custom stdenv to use Clang/LLVM 18
- Regenerate LRE toolchains.
- Remove obsolete zig_cc toolchain
- Expand LRE CI to build C++ parts of NativeLink remotely in K8s and the
  rest of rules_rust locally.

Fixes TraceMachina#694
Closes TraceMachina#477
aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 23, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

- Update custom stdenv to use Clang/LLVM 18
- Regenerate LRE toolchains.
- Remove obsolete zig_cc toolchain
- Expand LRE CI to build C++ parts of NativeLink remotely in K8s and the
  rest of rules_rust locally.

Fixes TraceMachina#694
Closes TraceMachina#477
aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 25, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

The LRE workflows now build the C++ parts of NativeLink remotely in K8s
and the Rust parts locally.

Closes TraceMachina#477
aaronmondal added a commit to aaronmondal/nativelink that referenced this issue Apr 25, 2024
This commit changes the default C++ toolchain to the custom nix-backed
clang toolchain.

The LRE workflows now build the C++ parts of NativeLink remotely in K8s
and the Rust parts locally.

Closes TraceMachina#477
@aaronmondal
Copy link
Member Author

Fixed in #1510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants