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

cc_toolchain: prefix include directories with %workspace% #438

Merged

Conversation

ParkMyCar
Copy link
Contributor

Today the built_in_includes_directores that are exported by this toolchain, appear to be incorrect. For example, when using toolchains_llvm locally with clang 18.1.8 one of the includes paths is:

external/llvm_toolchain/external/llvm_toolchain_llvm/include/aarch64-apple-macosx/c++/v1

This path does not exist, it's incorrectly prefixed with external/llvm_toolchain/. This is because when populating the list of built_in_includes_directories Bazel will resolve the included directory based on these rules. Specifically the rule we're hitting today, and the cause of the invalid prefixing is:

If it starts with %crosstool_top%/ or is any relative path, it is interpreted relative to the crosstool top.

This PR changes the includes paths to be prefixed with %workspace% so instead no prefix is added.

@fmeum fmeum force-pushed the cc_toolchain/prefix-include-directories branch from 06e281e to 102310d Compare January 10, 2025 23:43
Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Nice find!

@fmeum fmeum enabled auto-merge (squash) January 10, 2025 23:44
Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Nice find!

@fmeum fmeum merged commit 9f0a7cb into bazel-contrib:master Jan 11, 2025
35 checks passed
@ParkMyCar
Copy link
Contributor Author

Woohoo! Thanks @fmeum!

ParkMyCar added a commit to MaterializeInc/materialize that referenced this pull request Jan 13, 2025
This PR makes our Bazel build fully hermetic, mainly by refactoring how
we built the `librocksdb-sys` crate. Previously we had to rely on some
hacks because `librocksdb-sys` uses bindgen which was tricky to get
working.

Specifically the changes this PR makes are:
* upgrades to [`clang
18.1.8-5`](https://github.com/MaterializeInc/toolchains/releases/tag/clang-18.1.8-5)
* upgrades to newer version of `toolchains_llvm` that includes an
[upstream
fix](bazel-contrib/toolchains_llvm#438)
* adds `rust_bindgen` toolchains with new `libclang` package from our
toolchains repo
* refactors the rocksdb build to be hermetic

### Motivation

Improves the quality of our build, allows us to move to a "minimum" CI
builder image for faster build times

### Tips for reviewer

<!--
Leave some tips for your reviewer, like:

    * The diff is much smaller if viewed with whitespace hidden.
    * [Some function/module/file] deserves extra attention.
* [Some function/module/file] is pure code movement and only needs a
skim.

Delete this section if no tips.
-->

### Checklist

- [ ] This PR has adequate test coverage / QA involvement has been duly
considered. ([trigger-ci for additional test/nightly
runs](https://trigger-ci.dev.materialize.com/))
- [ ] This PR has an associated up-to-date [design
doc](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/README.md),
is a design doc
([template](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/00000000_template.md)),
or is sufficiently small to not require a design.
  <!-- Reference the design in the description. -->
- [ ] If this PR evolves [an existing `$T ⇔ Proto$T`
mapping](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/command-and-response-binary-encoding.md)
(possibly in a backwards-incompatible way), then it is tagged with a
`T-proto` label.
- [ ] If this PR will require changes to cloud orchestration or tests,
there is a companion cloud PR to account for those changes that is
tagged with the release-blocker label
([example](MaterializeInc/cloud#5021)).
<!-- Ask in #team-cloud on Slack if you need help preparing the cloud
PR. -->
- [ ] If this PR includes major [user-facing behavior
changes](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/guide-changes.md#what-changes-require-a-release-note),
I have pinged the relevant PM to schedule a changelog post.
@ParkMyCar ParkMyCar deleted the cc_toolchain/prefix-include-directories branch January 18, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants