Skip to content

Conversation

@Jarred-Sumner
Copy link
Collaborator

What does this PR do?

How did you verify your code works?

@robobun
Copy link
Collaborator

robobun commented Sep 29, 2025

Updated 5:51 AM PT - Sep 30th, 2025

@Jarred-Sumner, your commit 261bb25 has 3 failures in Build #27619 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 23075

That installs a local version of the PR into your bun-23075 executable, so you can run:

bun-23075 --bun

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

Adds a nullable llvm_codegen_threads option to Zig build options (CLI-initialized, default 1), wires it into per-object config in Debug builds when available, sets no_link_obj = true, broadens use_lld condition to mac/linux, adds LLVM_ZIG_CODEGEN_THREADS and multi-output handling in CMake, and updates the Zig commit hash.

Changes

Cohort / File(s) Summary of changes
Zig build options & object handling
build.zig
Added llvm_codegen_threads: ?u32 = null to BunBuildOptions; build() initializes .llvm_codegen_threads from CLI option llvm_codegen_threads (defaults to 1); configureObj (Debug) sets obj.llvm_codegen_threads when the field exists (uses hasField), sets obj.no_link_obj = true, and changes obj.use_lld to false for mac or linux.
CMake: build target and defines
cmake/targets/BuildBun.cmake
Introduced LLVM_ZIG_CODEGEN_THREADS (default 0); when >1 emits multiple outputs bun-zig.N.o (per thread) otherwise a single bun-zig.o; passes -Dllvm_codegen_threads=${LLVM_ZIG_CODEGEN_THREADS} into the Zig build command.
CMake: Zig setup
cmake/tools/SetupZig.cmake
Updated ZIG_COMMIT value to 55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Faster linux zig build” is vague and only partially related to the changeset, as the pull request’s main focus is adding an llvm_codegen_threads option and updating both build.zig and CMake targets for multi-threaded LLVM codegen, which is not clearly conveyed by the current phrasing. Please update the title to succinctly describe the main feature, for example “Add llvm_codegen_threads option for multi-threaded LLVM codegen in Bun build” to clearly indicate the primary change.
Description Check ⚠️ Warning The PR description includes the required template headings but does not provide any content under “What does this PR do?” or “How did you verify your code works?”, leaving both sections empty and thus lacking essential details about the changes and validation. Please fill in the description sections with a summary of the PR’s purpose and the steps taken to verify that the changes work as expected, including any tests or local build/validation commands used.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jarred/zig-bump-2

🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
cmake/targets/BuildBun.cmake (2)

47-54: Make threads configurable and default smartly (optional)

You hard-default to 0 and commented out CPU-based default. Consider re-enabling a DEBUG-only CPU count or reading from env (e.g., BUN_LLVM_CODEGEN_THREADS) to simplify local experimentation.


639-639: Pass flag only when meaningful (optional)

Avoid emitting -Dllvm_codegen_threads when 0 to keep zig cmdline clean.

-      -Dllvm_codegen_threads=${LLVM_ZIG_CODEGEN_THREADS}
+      $<IF:$<GREATER:${LLVM_ZIG_CODEGEN_THREADS},0>,-Dllvm_codegen_threads=${LLVM_ZIG_CODEGEN_THREADS},>
build.zig (1)

273-274: Default mismatch vs CMake (clarify semantics)

CMake defaults threads to 0, but here the default is 1. This makes “unspecified” behave differently between CMake and direct zig builds. Either unify to 0 or document 0=single-threaded, >1=sharded.

-        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of threads to use for LLVM codegen") orelse 1,
+        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of threads to use for LLVM codegen (0 = single-threaded)") orelse 0,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f6e722b and 49efc61.

📒 Files selected for processing (3)
  • build.zig (3 hunks)
  • cmake/targets/BuildBun.cmake (3 hunks)
  • cmake/tools/SetupZig.cmake (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)

**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue

**/*.zig: Format Zig files with zig-format (bun run zig-format)
In Zig, manage memory carefully with allocators and use defer for cleanup

Files:

  • build.zig
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: oven-sh/bun#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T04:44:59.101Z
Learning: For platform-specific changes, run bun run zig:check-all to compile on all platforms
📚 Learning: 2025-09-08T04:44:59.101Z
Learnt from: CR
PR: oven-sh/bun#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T04:44:59.101Z
Learning: For platform-specific changes, run bun run zig:check-all to compile on all platforms

Applied to files:

  • cmake/tools/SetupZig.cmake
  • build.zig
  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-08-30T00:13:36.815Z
Learnt from: CR
PR: oven-sh/bun#0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-08-30T00:13:36.815Z
Learning: Applies to src/bun.js/bindings/generated_classes_list.zig : Update src/bun.js/bindings/generated_classes_list.zig to include new classes

Applied to files:

  • cmake/targets/BuildBun.cmake
🔇 Additional comments (2)
cmake/tools/SetupZig.cmake (1)

23-23: Zig commit bump: confirm feature compatibility and caches

Please confirm this commit includes Compile.no_link_obj and llvm_codegen_threads, since build.zig now guards/uses them. Clear vendor/zig caches in CI to avoid mixing old stdlib with the new compiler.

Based on learnings

build.zig (1)

71-72: New option looks good

Field addition is fine and gated usage via @Hasfield elsewhere prevents older Zig breakage.

Comment on lines 589 to 595
if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
foreach(i RANGE ${LLVM_ZIG_CODEGEN_THREADS})
list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
endforeach()
else()
set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Off-by-one when expanding multi-object outputs

foreach(RANGE ${LLVM_ZIG_CODEGEN_THREADS}) yields N+1 entries (0..N). Use 0..(N-1).

Apply:

-  if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
-    foreach(i RANGE ${LLVM_ZIG_CODEGEN_THREADS})
-      list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
-    endforeach()
+  if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
+    math(EXPR LLVM_ZIG_CODEGEN_THREADS_LAST "${LLVM_ZIG_CODEGEN_THREADS} - 1")
+    foreach(i RANGE 0 ${LLVM_ZIG_CODEGEN_THREADS_LAST})
+      list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
+    endforeach()
   else()
     set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
   endif()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
foreach(i RANGE ${LLVM_ZIG_CODEGEN_THREADS})
list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
endforeach()
else()
set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
endif()
if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
math(EXPR LLVM_ZIG_CODEGEN_THREADS_LAST "${LLVM_ZIG_CODEGEN_THREADS} - 1")
foreach(i RANGE 0 ${LLVM_ZIG_CODEGEN_THREADS_LAST})
list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
endforeach()
else()
set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
endif()
🤖 Prompt for AI Agents
cmake/targets/BuildBun.cmake lines 589-595: the foreach(RANGE
${LLVM_ZIG_CODEGEN_THREADS}) call expands 0..N inclusive causing an off-by-one;
compute LAST = LLVM_ZIG_CODEGEN_THREADS - 1 (use math(EXPR LAST
"${LLVM_ZIG_CODEGEN_THREADS} - 1")) and then loop foreach(i RANGE 0 ${LAST}) to
produce indices 0..(N-1) and append BUILD_PATH/bun-debug.${i}.o; keep the
existing else() branch for the single-output case.

⚠️ Potential issue | 🟠 Major

Output name likely mismatches Zig’s installed artifact

zig build obj installs bun-zig.o (see build.zig:addInstallObjectFile("bun-zig", …)). CMake expects bun-debug*.o. Align names or the link/ARTIFACTS tracking will break.

Option A (align to Zig’s installer):

-      list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
+      list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-zig.${i}.o)
...
-    set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
+    set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-zig.o)

Option B: change build.zig’s installer to emit bun-debug*.o. Pick one and keep it consistent end-to-end. Please run bun run zig:check-all after changing. Based on learnings

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
foreach(i RANGE ${LLVM_ZIG_CODEGEN_THREADS})
list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.${i}.o)
endforeach()
else()
set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-debug.o)
endif()
if (LLVM_ZIG_CODEGEN_THREADS GREATER 1)
foreach(i RANGE ${LLVM_ZIG_CODEGEN_THREADS})
list(APPEND BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-zig.${i}.o)
endforeach()
else()
set(BUN_ZIG_OUTPUT ${BUILD_PATH}/bun-zig.o)
endif()
🤖 Prompt for AI Agents
In cmake/targets/BuildBun.cmake around lines 589-595, CMake is appending
expected Zig output filenames bun-debug(.i).o but Zig’s build.zig installs
bun-zig.o, causing artifact name mismatch; fix by choosing one naming convention
and applying it consistently: either update these CMake BUN_ZIG_OUTPUT entries
to use bun-zig(.i).o to match build.zig, or change build.zig’s
addInstallObjectFile to emit bun-debug(.i).o to match CMake; after changing,
ensure all references (linking, ARTIFACTS lists, install rules) are updated and
run bun run zig:check-all to validate.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
build.zig (1)

71-71: Clarify semantics for llvm_codegen_threads in options

Field type is ?u32 but downstream defaulting to 1 (Line 273) defeats “null => auto” semantics. Recommend letting null propagate so configureObj can use orelse 0 for “auto”.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between eacc2f8 and c6830a3.

📒 Files selected for processing (1)
  • build.zig (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)

**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue

**/*.zig: Format Zig files with zig-format (bun run zig-format)
In Zig, manage memory carefully with allocators and use defer for cleanup

Files:

  • build.zig
🧠 Learnings (2)
📚 Learning: 2025-09-08T04:44:59.101Z
Learnt from: CR
PR: oven-sh/bun#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T04:44:59.101Z
Learning: For platform-specific changes, run bun run zig:check-all to compile on all platforms

Applied to files:

  • build.zig
📚 Learning: 2025-08-30T00:13:36.815Z
Learnt from: CR
PR: oven-sh/bun#0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-08-30T00:13:36.815Z
Learning: Applies to src/bun.js/bindings/generated_classes_list.zig : Update src/bun.js/bindings/generated_classes_list.zig to include new classes

Applied to files:

  • build.zig
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Format
🔇 Additional comments (3)
build.zig (3)

610-616: Compile break: obj.no_link_obj is not a field on Zig 0.14 Compile (and llvm_codegen_threads likely isn’t either)

Unconditional obj.no_link_obj = true; will fail on Zig 0.14. The guarded llvm_codegen_threads is fine, but no_link_obj must be removed or gated; also consider removing the whole block since these fields aren’t part of 0.14’s public API.

Apply this minimal, safe fix:

-    if (opts.optimize == .Debug) {
-        if (@hasField(std.meta.Child(@TypeOf(obj)), "llvm_codegen_threads"))
-            obj.llvm_codegen_threads = opts.llvm_codegen_threads orelse 0;
-    }
-
-        obj.no_link_obj = true;
+    if (opts.optimize == .Debug) {
+        if (@hasField(std.meta.Child(@TypeOf(obj)), "llvm_codegen_threads")) {
+            obj.llvm_codegen_threads = opts.llvm_codegen_threads orelse 0; // 0 => auto
+        }
+    }
+    if (@hasField(std.meta.Child(@TypeOf(obj)), "no_link_obj")) {
+        obj.no_link_obj = true;
+    }

Alternatively, if you don’t plan to target a Zig with these fields soon, delete both assignments entirely.

#!/bin/bash
# Prove the fix compiles across targets
bun run zig:check-all

Based on learnings


677-678: Restore platform-specific extensions for object files
Object files are currently installed without an extension, which can break downstream tooling (e.g., CMake scripts expecting “.o”/“.obj”). In addInstallObjectFile (build.zig:677–678), change the fmt call to include the correct suffix: if (target.os.tag == .windows) ".obj" else ".o" after the base name.


273-274: Default llvm_codegen_threads to null

Remove the orelse 1 fallback so opts.llvm_codegen_threads remains null when unset, allowing configureObj’s orelse 0 to trigger “auto” threading:

-        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of threads to use for LLVM codegen") orelse 1,
+        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of threads to use for LLVM codegen"),

Run your Zig build tests (e.g. zig build test) to verify no regressions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
build.zig (3)

71-71: Add documentation for llvm_codegen_threads field.

The new field lacks a doc comment explaining its purpose, valid values, and the semantics of null vs 0 vs positive integers. This would help maintainers understand when and how to use this option.

Consider adding a comment like:

+    /// Number of LLVM codegen threads. null or 0 = single-threaded, 1+ = parallel.
+    /// Only applies in Debug builds when the Zig compiler supports it.
     llvm_codegen_threads: ?u32 = null,

273-273: Clarify default value semantics and improve option description.

The default value of 1 for llvm_codegen_threads is unusual—typically threading options default to 0 (disabled/single-threaded) or auto-detect the CPU count. Verify whether 1 means "single worker thread" (effectively 2 threads total) or "single-threaded mode."

Additionally, the option description is empty. Consider improving it:

-        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of threads to use for LLVM codegen") orelse 1,
+        .llvm_codegen_threads = b.option(u32, "llvm_codegen_threads", "Number of LLVM codegen worker threads (0=single-threaded, 1+=parallel)") orelse 1,

610-613: Drop the unnecessary @hasField guard for llvm_codegen_threads
The pinned Zig commit 71b7bdb81e4807578911ebeaee3c0e8d292e3724 defines both llvm_codegen_threads and no_link_obj, so the @hasField check can be removed to match the unconditional obj.no_link_obj assignment.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 71cb294 and 41ebc44.

📒 Files selected for processing (1)
  • build.zig (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)

**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue

**/*.zig: Format Zig files with zig-format (bun run zig-format)
In Zig, manage memory carefully with allocators and use defer for cleanup

Files:

  • build.zig
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: oven-sh/bun#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T04:44:59.101Z
Learning: For platform-specific changes, run bun run zig:check-all to compile on all platforms
📚 Learning: 2025-09-08T04:44:59.101Z
Learnt from: CR
PR: oven-sh/bun#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T04:44:59.101Z
Learning: For platform-specific changes, run bun run zig:check-all to compile on all platforms

Applied to files:

  • build.zig
🔇 Additional comments (4)
build.zig (4)

615-615: Consider gating no_link_obj with @hasField check for consistency.

Line 615 unconditionally sets obj.no_link_obj = true, while line 611 gates llvm_codegen_threads with @hasField. If no_link_obj also doesn't exist in certain Zig versions (as past review comments suggested), this will cause a compilation error.

Apply this diff to add consistency:

-    obj.no_link_obj = true;
+    if (@hasField(std.meta.Child(@TypeOf(obj)), "no_link_obj"))
+        obj.no_link_obj = true;

Alternatively, if the Zig version is now guaranteed to have both fields, remove all @hasField checks for clarity:

-    if (opts.optimize == .Debug) {
-        if (@hasField(std.meta.Child(@TypeOf(obj)), "llvm_codegen_threads"))
-            obj.llvm_codegen_threads = opts.llvm_codegen_threads orelse 0;
-    }
-
-    obj.no_link_obj = true;
+    if (opts.optimize == .Debug) {
+        obj.llvm_codegen_threads = opts.llvm_codegen_threads orelse 0;
+    }
+    obj.no_link_obj = true;

610-613: Debug-only parallel codegen is a reasonable optimization.

Limiting llvm_codegen_threads to Debug builds makes sense for faster iteration during development. Release builds likely benefit more from other optimization strategies.


273-273: Align default LLVM codegen thread counts between CMake and Zig build
CMake sets LLVM_ZIG_CODEGEN_THREADS to 0 by default (cmake/targets/BuildBun.cmake:47), but in build.zig the fallback is 1 (build.zig:273). Either synchronize these defaults or document the reason for their divergence.


610-616: Verify build changes on all platforms. The modifications to configureObj affect every supported target. Run bun run zig:check-all (or trigger the equivalent CI job) locally to compile for all platforms and confirm that no_link_obj and llvm_codegen_threads behave correctly across environments.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a5ab4c0 and 99ff06d.

📒 Files selected for processing (1)
  • cmake/tools/SetupZig.cmake (1 hunks)

endif()

set(ZIG_COMMIT "e0b7c318f318196c5f81fdf3423816a7b5bb3112")
set(ZIG_COMMIT "9853cc36e73702ad4032dcaceb22e53db9a039f2")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the Zig commit hash and its compatibility with the new threading feature.

Given the widespread build failures reported in the PR (affecting macOS, Linux, and Windows builds), this Zig compiler version bump should be verified for:

  1. Accessibility of the commit in the Zig repository
  2. Support for the new llvm_codegen_threads option introduced in other files
  3. Any known regressions or compatibility issues

Run the following script to verify the Zig commit:

Additionally, search for documentation on the llvm_codegen_threads feature:


🏁 Script executed:

#!/bin/bash
# Verify the new Zig commit exists and check for recent issues

# Check if the commit exists in the Zig repository
echo "=== Checking Zig commit existence ==="
git ls-remote https://github.com/ziglang/zig.git 9853cc36e73702ad4032dcaceb22e53db9a039f2

# Get commit details
echo -e "\n=== Fetching commit details ==="
gh api repos/ziglang/zig/commits/9853cc36e73702ad4032dcaceb22e53db9a039f2 --jq '{sha: .sha, date: .commit.committer.date, message: .commit.message}'

# Check for any related issues or discussions about this commit
echo -e "\n=== Searching for issues mentioning this commit ==="
gh search issues --repo ziglang/zig "9853cc36e73702ad4032dcaceb22e53db9a039f2" --limit 5 --json title,url,state

Length of output: 573


🌐 Web query:

Zig compiler llvm_codegen_threads option support

💡 Result:

Short answer: No — Zig does not currently provide a supported way to set LLVM's codegen/parallel-codegen threads for Zig codegen (there’s no exposed llvm_codegen_threads / -mllvm pass-through for Zig-language compilation). See the open GitHub issue requesting the ability to pass LLVM-specific flags from build.zig and related discussion. [1][2]

Sources:


Remove or guard llvm_codegen_threads option until upstream support
Verified commit 9853cc36e73702ad4032dcaceb22e53db9a039f2 exists (Sep 30 2025) but Zig does not expose an llvm_codegen_threads flag for Zig codegen (see issue #12726), so this option will be a no-op.

🤖 Prompt for AI Agents
In cmake/tools/SetupZig.cmake around line 23, the repo pins Zig to commit
9853cc36e73702ad4032dcaceb22e53db9a039f2 but the CMake option or use of
llvm_codegen_threads is unsupported by upstream Zig (no zig codegen flag), so
remove any configuration that sets or passes llvm_codegen_threads, or wrap its
creation/use with a feature check: either delete the option and related logic
entirely or gate it behind a version/commit or feature-detection test (query the
Zig binary or commit/semver before adding the option) so the option is a no-op
until upstream adds support.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 91071cf and 261bb25.

📒 Files selected for processing (1)
  • cmake/tools/SetupZig.cmake (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Format

endif()

set(ZIG_COMMIT "e0b7c318f318196c5f81fdf3423816a7b5bb3112")
set(ZIG_COMMIT "55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the new Zig commit and its relationship to build failures.

The commit hash change occurs alongside widespread build failures across macOS, Linux, and Windows reported in the PR. Additionally, a previous review flagged that Zig doesn't expose llvm_codegen_threads for Zig codegen (see Zig issue #12726), yet this PR introduces that option.

Run the following script to verify the commit exists and check for any related issues:

Additionally, search for the latest status on Zig's LLVM codegen threading support:


🏁 Script executed:

#!/bin/bash
# Verify the new Zig commit exists and gather details

echo "=== Checking if Zig commit exists ==="
git ls-remote https://github.com/ziglang/zig.git 55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2

echo -e "\n=== Fetching commit details ==="
gh api repos/ziglang/zig/commits/55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2 --jq '{sha: .sha, date: .commit.committer.date, message: .commit.message, author: .commit.author.name}' 2>/dev/null || echo "Commit not found or API error"

echo -e "\n=== Searching for issues mentioning this commit ==="
gh search issues --repo ziglang/zig "55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2" --limit 5 --json title,url,state 2>/dev/null || echo "No issues found"

echo -e "\n=== Checking recent Zig issues related to LLVM codegen ==="
gh search issues --repo ziglang/zig "llvm codegen threads OR llvm_codegen_threads" --limit 5 --json title,url,state,createdAt

Length of output: 627


🌐 Web query:

Zig commit 55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2 llvm_codegen_threads support

💡 Result:

Do you want me to locate and summarize that specific commit (55fdbfa...) on the Zig repository and explain how it added/changed llvm_codegen_threads support? If so I’ll fetch the commit and report the diff and implications.


Zig commit bump valid but doesn’t add LLVM codegen threading support
Commit 55fdbfa0c86be86b68d43a4ba761e6909eb0d7b2 exists and fixes MachO --no-link, but upstream Zig still lacks llvm_codegen_threads. Remove or guard the threading flag to restore successful builds on macOS, Linux, and Windows.

🤖 Prompt for AI Agents
In cmake/tools/SetupZig.cmake around line 23, the updated Zig commit is fine but
the build is adding an llvm_codegen_threads flag that upstream Zig doesn't
support yet; remove or guard usage of the threading flag to prevent build
failures. Edit the CMake logic that passes flags to Zig so it no longer
unconditionally adds llvm_codegen_threads — either remove that flag entirely or
wrap it in a conditional that checks the target platform/version (e.g., only
enable for environments where Zig exposes llvm_codegen_threads) or probe the Zig
binary for support before adding the flag; update comments and keep the commit
bump intact.

@Jarred-Sumner Jarred-Sumner merged commit 9aa3c78 into main Sep 30, 2025
42 of 62 checks passed
@Jarred-Sumner Jarred-Sumner deleted the jarred/zig-bump-2 branch September 30, 2025 21:59
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.

3 participants