Skip to content

build: respect config.emit_xcframework for building libghostty-vt.xcframework on Darwin#12267

Merged
mitchellh merged 7 commits intoghostty-org:mainfrom
0xDVC:fix/xcframework-macos-dependency
Apr 24, 2026
Merged

build: respect config.emit_xcframework for building libghostty-vt.xcframework on Darwin#12267
mitchellh merged 7 commits intoghostty-org:mainfrom
0xDVC:fix/xcframework-macos-dependency

Conversation

@0xDVC
Copy link
Copy Markdown
Contributor

@0xDVC 0xDVC commented Apr 13, 2026

This fixes a hardcoded build issue on macOS where Zig unconditionally forces xcodebuild -create-xcframework to run during compilation, even when the caller explicitly specifies that they only want the raw standard C objects/headers (-Demit-lib-vt).

@ghostty-vouch
Copy link
Copy Markdown
Contributor

ghostty-vouch Bot commented Apr 13, 2026

Hi @0xDVC, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/ghostty-org/ghostty/blob/main/CONTRIBUTING.md for more details.

@ghostty-vouch ghostty-vouch Bot closed this Apr 13, 2026
@mitchellh
Copy link
Copy Markdown
Contributor

!vouch

ghostty-vouch Bot pushed a commit that referenced this pull request Apr 13, 2026
@ghostty-vouch ghostty-vouch Bot mentioned this pull request Apr 13, 2026
ghostty-vouch Bot added a commit that referenced this pull request Apr 13, 2026
Triggered by
[comment](#12267 (comment))
from @mitchellh.

Vouch: @0xDVC

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mitchellh mitchellh reopened this Apr 13, 2026
@0xDVC 0xDVC marked this pull request as ready for review April 13, 2026 14:29
kazto pushed a commit to kazto/ghostty that referenced this pull request Apr 14, 2026
Triggered by
[comment](ghostty-org#12267 (comment))
from @mitchellh.

Vouch: @0xDVC

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mitchellh mitchellh enabled auto-merge April 14, 2026 14:10
@mitchellh mitchellh added this to the 1.4.0 milestone Apr 14, 2026
@mitchellh
Copy link
Copy Markdown
Contributor

We've got some CI failures, we should look into it. I thought our swift example should have xcode and we should default emit xcframework to true.

auto-merge was automatically disabled April 14, 2026 18:00

Head branch was pushed to by a user without write access

kicanter pushed a commit to kicanter/ghostty-dev that referenced this pull request Apr 18, 2026
Triggered by
[comment](ghostty-org#12267 (comment))
from @mitchellh.

Vouch: @0xDVC

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@jcollie
Copy link
Copy Markdown
Member

jcollie commented Apr 23, 2026

@0xDVC Looks like build.zig isn't properly formatted. We require that all Zig files are formatted with zig fmt.

@0xDVC
Copy link
Copy Markdown
Contributor Author

0xDVC commented Apr 23, 2026

@0xDVC Looks like build.zig isn't properly formatted. We require that all Zig files are formatted with zig fmt.

@jcollie should be okay now. weird that I missed that

Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Sorry for the back and forth on this, I should probably just pick this up myself. Not happy with where this is at currently.

  • We should reuse the emit-xcframework and not introduce a new flag (just have it semantically affect lib vt too)
  • We should change the default to whether we can detect xcode tools or not
  • I don't understand why the swift-vt-xcframework Package.swift had to change

@0xDVC
Copy link
Copy Markdown
Contributor Author

0xDVC commented Apr 23, 2026

Sorry for the back and forth on this, I should probably just pick this up myself. Not happy with where this is at currently.

  • We should reuse the emit-xcframework and not introduce a new flag (just have it semantically affect lib vt too)
  • We should change the default to whether we can detect xcode tools or not
  • I don't understand why the swift-vt-xcframework Package.swift had to change

@mitchellh zig build -Demit-lib-vt was unconditionally invoking xcodebuild to produce the xcframework, which breaks on machines with only command-line tools and no full xcode.

The fix was supposed to gate it behind emit-xcframework, which now auto-detects xcodebuild in PATH rather than introducing a new flag.

The Package.swift change was a fix for the interim approach and is reverted since it's no longer needed.

I'm probably missing something here, but made some new changes. so do have a look

@0xDVC 0xDVC requested a review from mitchellh April 23, 2026 17:09
0xDVC and others added 5 commits April 24, 2026 13:21
…ramework on Darwin

This fixes a hardcoded build issue on macOS where Zig unconditionally forces xcodebuild -create-xcframework to run during compilation, even when the caller explicitly specifies that they only want the raw standard C objects/headers (-Demit-lib-vt).

The Bug:
Around line 155 in build.zig, the libghostty-vt xcframework was being packaged unconditionally for Darwin builds. This caused developers (and wrappers like go-libghostty) attempting to natively build the vt library locally using only the minimal macOS Command Line Tools to experience an immediate crash, as xcodebuild -create-xcframework strictly demands a full Xcode application installation.

The Fix:
Guarded the GhosttyLibVt xcframework creation step with config.emit_xcframework. Because src/build/Config.zig intuitively forces emit_xcframework to default to false whenever emit_lib_vt is invoked, this structurally allows lightweight macOS builds to safely skip the xcodebuild invocation while still correctly compiling the standard .a object library files.
@mitchellh mitchellh force-pushed the fix/xcframework-macos-dependency branch from 86dbecf to 44a2d87 Compare April 24, 2026 20:22
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

That looks right! I rebased and got rid of the libc++ linkage on our Swift example, we don't rely on libc++ anymore.

@mitchellh mitchellh merged commit d35f02d into ghostty-org:main Apr 24, 2026
86 checks passed
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.

3 participants