Skip to content

feat: [NODE-1566] Build with hermetic cc toolchains (again)#4848

Merged
Bownairo merged 29 commits into
masterfrom
eero/hermetic-toolchain-again
May 8, 2025
Merged

feat: [NODE-1566] Build with hermetic cc toolchains (again)#4848
Bownairo merged 29 commits into
masterfrom
eero/hermetic-toolchain-again

Conversation

@Bownairo

@Bownairo Bownairo commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Following #3508 and #4621

What has changed since last time?

  • dd17358 - Share the zig cache across targets to improve build speed. zig cc builds system components on demand, and the shared cache means these are only built once.
  • 80f68ab + 31d8822 - Strip debug_info, but preserve symbols, to fix traces. zig cc can only strip everything, or nothing at all. First patch rules_rust to disable the default stripping, then patch hermetic_cc_toolchain to strip only debug_info, outside of the main call to zig cc.

@Bownairo Bownairo force-pushed the eero/hermetic-toolchain-again branch 6 times, most recently from c60223f to 845290d Compare April 18, 2025 18:59
@Bownairo Bownairo force-pushed the eero/hermetic-toolchain-again branch 15 times, most recently from 80b03db to 3df8a96 Compare April 24, 2025 17:46
github-merge-queue Bot pushed a commit that referenced this pull request Apr 29, 2025
Enabling the hermetic CC toolchain (again) in
#4848 is causing an Out Of Memory
error at the end of the `bazel test` invocation because we use
[`--execution_log_json_file`](https://bazel.build/reference/command-line-reference#build-flag--execution_log_json_file).
We fix this by using the more CPU and memory efficient
[`--execution_log_compact_file`](https://bazel.build/reference/command-line-reference#build-flag--execution_log_compact_file)
and converting the resulting zstandard compressed length-delimited
protobuf-encoded file to CSV using a Python program.
@Bownairo Bownairo force-pushed the eero/hermetic-toolchain-again branch 4 times, most recently from d56dddd to 94f5af7 Compare May 5, 2025 21:04

@basvandijk basvandijk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🎉

@venkkatesh-sekar venkkatesh-sekar self-requested a review May 7, 2025 08:55

@venkkatesh-sekar venkkatesh-sekar left a comment

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.

🥳 Looks good from fuzzing side.

@Bownairo Bownairo enabled auto-merge May 7, 2025 22:32
@Bownairo Bownairo added this pull request to the merge queue May 7, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2025
@Bownairo Bownairo added this pull request to the merge queue May 8, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2025
@Bownairo Bownairo added this pull request to the merge queue May 8, 2025
Merged via the queue into master with commit 2f52f29 May 8, 2025
@Bownairo Bownairo deleted the eero/hermetic-toolchain-again branch May 8, 2025 01:57
github-merge-queue Bot pushed a commit that referenced this pull request May 12, 2025
CI sometimes runs into [the following
error](https://github.com/dfinity/ic/actions/runs/14966115526/job/42037281951)
on the workflow: Bazel Test macOS Apple Silicon:
```
ERROR: /Users/runner/work/ic/ic/rs/nns/handlers/lifeline/impl/BUILD.bazel:35:16: CopyIdlFiles 
rs/nns/handlers/lifeline/impl/actor_idl_path failed: I/O exception during sandboxed execution: 
/private/tmp/zig-cache (No such file or directory)
```

`.github/workflows/test-namespace-darwin.yaml` doesn't actually use
`.github/actions/bazel` which creates the `/tmp/zig-cache` directory. So
let's create it.

It's unclear why this failure only happens sometimes and [didn't
happen](https://github.com/dfinity/ic/actions/runs/14894656219/job/41834646820)
on #4848 which re-introduced the
hermetic CC toolchain.

This also drops:
```
          # Until we have a hermetic CC toolchain, tell bazel to use the "real" clang
          # (instead of Apple's, which sometimes breaks on wasm32)
          export CC=/opt/homebrew/opt/llvm/bin/clang
```
since we now have the hermetic CC toolchain available.
github-merge-queue Bot pushed a commit that referenced this pull request Jun 27, 2025
Long ago, #1946 was pushed and
reverted because it raised the minimum required libc version of our
distributed binaries. With #4848, we
should be able to upgrade again without this bump.

---------

Co-authored-by: IDX GitHub Automation <>
github-merge-queue Bot pushed a commit that referenced this pull request Aug 12, 2025
`anyhow` captures a backtrace whenever an error is created. This can be
quite expensive and has lead to a performance regression after updating
the `libunwind` version in #4848.

The P2P code does not make use of this backtrace anywhere.

Therefore, this PR removes `anyhow` from all P2P crates, and replaces it
with a custom opaque error type, that doesn't capture backtraces.

See also this issue: dtolnay/anyhow#346

---------

Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
kpop-dfinity pushed a commit that referenced this pull request Aug 13, 2025
`anyhow` captures a backtrace whenever an error is created. This can be
quite expensive and has lead to a performance regression after updating
the `libunwind` version in #4848.

The P2P code does not make use of this backtrace anywhere.

Therefore, this PR removes `anyhow` from all P2P crates, and replaces it
with a custom opaque error type, that doesn't capture backtraces.

See also this issue: dtolnay/anyhow#346

---------

Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants