-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
(regression) building macOS binary without XCode / Command Line Tools installed fails #10217
Comments
I just want to confirm that this is indeed a regression from intended behavior, and we should be sure to resolve it before tagging 0.9.0. |
@slimsag Oh I see now. The issue does not seem to be with xcrun but rather with the fact that we incorrectly try to detect native libc include dirs in |
@andrewrk It is definitely a regression in behavior since the 0.8 release, yes. That said, it is fairly minor behavior (most people have XCode installed) and it has a straightforward workaround (install XCode), so not the end of the world if we tag 0.9 without a fix for it. @kubkon thanks for the investigation and PR, I will test+review today! |
Actually, it's a huge regression from our perspective, since we really want zig to be a true, bare system replacement on macOS too :-) So I very much appreciate you noting it and submitting a ticket - thank you! |
(BTW, I actually nuked my Xcode and CLT testing the fix in the linked PR hahaha) |
Super glad to hear you share that perspective ❤️ Haha, wow. FWIW, in the future if you ever need to test the same thing, I think moving your XCode.app to elsewhere (desktop, trash, etc.) and |
So I actually thought about moving Xcode.app but then I noticed it takes 34GB (!!!), so it took me less time to just nuke it. I actually don't need it per se at the moment as I only need macOS SDK for now :-) |
Is it possible this has regressed again? I just tried to get set up with zig on a Mac with Sonoma:
One possible weirdness is that I had an old version incompatible version of Xcode installed. I tried deleting it and the command line tools and still see the same issue though. |
Zig Version
0.9.0-dev.1696+ff9a44a9f
Steps to Reproduce
zig build
any Zig project without cross-compilationzig build -D=target=aarch64-macos
with cross-compilation (to the same target as the host)Expected Behavior
Both commands should successfully build a macOS binary without XCode / Command Line Tools being installed.
Given that Zig can cross-compile for macOS without those being installed on other targets, I think it is a super nice property to maintain that if you don't have those installed on a mac host that you don't have to install them - specifically because they are multi-GB downloads that can often take a half hour to install.
In prior versions of Zig (several months after 0.8 was released) both commands would succeed without XCode / Command Line Tools being installed. After the introduction of calling
xcrun
in Zig, however, these began to fail. I've been meaning to file this for a while now. @kubkonActual Behavior
Both commands fail with the following:
After running, the
xcrun
dialog box prompting to install XCode pops up. If you dismiss it and re-run thezig
command multiple times, it eventually succeeds in producing the binary without XCode.The text was updated successfully, but these errors were encountered: