Skip to content

fix(ci): use rust's macho linker for macos java beta builds - #10687

Closed
BubbleCal wants to merge 3 commits into
mainfrom
yang/java-native-release-build
Closed

BubbleCal wants to merge 3 commits into
mainfrom
yang/java-native-release-build

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

The macOS Java beta publisher exceeded its 90-minute budget. With the existing ThinLTO profile, the build then reached Apple ld 1053.12's branch-range limitation: pinned ctor initialization calls across roughly 195 MB from __text_startup, beyond ARM64's direct-branch range.

Use the Mach-O LLD bundled with the existing Rust toolchain for the beta/PR JNI link. It generates range-extension thunks while retaining the separate startup section. The compiler driver still supplies the SDK and deployment arguments; a launcher supplies the bundled LLVM library path after Apple's driver sanitizes DYLD variables. The workflow adds no section-renaming override.

Keep the optimized ThinLTO profile, standalone JNI cache and Java CI protoc installer. Constructor-registration checks and Java write/open, filtered-count and delete tests run before upload. Stable release settings and the 90-minute budget are unchanged. macOS-only workflow PRs skip unchanged Linux work; release/manual runs still require all three native artifacts before Maven/R2 publication.

Validation on 4bfcf1f519cd3fe3bbf0bf949f8014d905e3b5aa:

  • Original macOS 14 runner: Apple clang 15.0.0, SDK 14.5, Rust 1.98.1 and bundled LLD 22.1.8. Native build finished in 33m 23s; constructor checks, all 3 Java tests and artifact upload passed. Rust/Java source trees, Cargo inputs/config and toolchain match the saved original failing checkout.
  • Downloaded hosted artifact retains __text_startup and __mod_init_func, has 299 JNI exports, passes code-signature verification, and shows the far-call thunks. It adds no LLVM runtime dependency.
  • Unchanged v15.0.0-beta.9 (025b3d93) also passes the actual compiler-driver recipe and the same 3 Java tests locally. A separate 140 MiB probe verifies two constructors execute once in priority order through the range-extension path. Actionlint and commit checks pass.

These results establish the matched build fix, not a product runtime performance improvement or official package publication. The PR remains draft for review of the corrected design. Existing beta.9 recovery still uses mode=release / ref=v15.0.0-beta.9, with actual tag-source builds and Maven/R2 package verification; the validation artifacts cannot substitute for released packages.

The validated source/config predates #10594. Current main separately retains that PR's root section-renaming configuration. This workflow change and the old-tag evidence do not establish a workaround-free current-main Python/Java release; that source-config correction and containing-release acceptance remain separate.

@github-actions github-actions Bot added A-ci CI / build workflows bug Something isn't working labels Nov 3, 2026
@BubbleCal BubbleCal changed the title fix(ci): use thinlto for macos java beta builds fix(ci): repair macos java beta native builds Nov 3, 2026
@BubbleCal
BubbleCal marked this pull request as ready for review November 3, 2026 18:44

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 3, 2026
Xuanwo
Xuanwo previously approved these changes Nov 3, 2026
@Xuanwo
Xuanwo marked this pull request as draft November 3, 2026 18:53
@lance-gatekeeper lance-gatekeeper Bot removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 3, 2026
@BubbleCal BubbleCal changed the title fix(ci): repair macos java beta native builds fix(ci): use rust's macho linker for macos java beta builds Nov 4, 2026
@BubbleCal
BubbleCal marked this pull request as ready for review November 4, 2026 05:42

@lance-gatekeeper lance-gatekeeper Bot 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.

⚠️ Gate recommendation: approve with a non-blocking risk.

The bundled Mach-O linker handles distant ctor calls while retaining startup and constructor-registration sections, with the compiler driver still supplying SDK and deployment arguments. This supports recovery of existing locked beta tags; upstream ctor removal would require a dependency update. Stable builds retain the release profile and system linker, and release/manual publication still requires all three native artifacts.

The macOS compiler-driver and Java runtime path, including completion within the 90-minute budget, could not be independently exercised in this review. Constructor-registration checks and Java data-operation tests gate artifact upload, making build/load failures visible before publication.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Nov 4, 2026
@Xuanwo Xuanwo closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci CI / build workflows bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants