-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
zig cc -target aarch64-macos-gnu
fails with FrameworkNotFound
when used with cgo
#10513
Comments
You need to manually specify include, library and framework search dirs for this to work. In cross-compilation mode, which Zig enters when you explicitly specify the target, no search paths are populated since we don't know where to expect them. Passing the sysroot is one thing, the next should be specifying |
Thanks for the tip @kubkon - I had to use Are there any other settings set by default when not specifying |
@andrewrk it looks like there are two issues here:
Do you want me to open a separate issue for the second part? |
Yes please 👍 |
Is it by any chance related to and fixed by #10568? If so, this fix should land in 0.9.1 I believe - cc'ing @andrewrk to confirm he cherry-picked the commit from the linked PR. |
Confirmed, it's in the 0.9.x branch as 3542dca. |
Done: #10790 |
Zig Version
0.9.0
Steps to Reproduce
I've created a repository https://github.com/charleskorn/zig-cgo-libs that contains a sample project, build script (
./build.sh
) and GitHub Actions workflow (sample build) that demonstrates the problem.To reproduce this for yourself, clone the repository and run
./build.sh
.The tl;dr appears to be: when using Zig as a C compiler for Golang's cgo, Zig fails to find the CoreFoundation framework if
-target
is specified explicitly. ie.zig cc -target aarch64-macos-gnu ...
fails, but if I compile on my M1 Mac with no-target
, the build succeeds.I've passed
--sysroot
with the path provided byxcrun --show-sdk-path
, as suggested in #10299 (comment).Expected Behavior
Build succeeds.
Actual Behavior
Build fails with a
FrameworkNotFound
error, and a warning that the framework could not be found (and that there are no framework search paths):I can see
zig
is being invoked with the expected arguments, for example:I see the same behaviour on both M1 and Intel hosts.
The text was updated successfully, but these errors were encountered: