Closed fbordwell closed 8 months ago
For reference, the xcode SDK seems to be properly accessible from my build environment:
❯ xcode-select -p
/Applications/Xcode.app/Contents/Developer
❯ find /Applications/Xcode.app -name Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h
❯ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
This is going back a ways, but I seem to recall seeing a similar error about Security.h
when trying to compile a different Rust project of mine on macOS:
warning: curl-sys@0.4.67+curl-8.3.0: curl/lib/vtls/sectransp.c:55:10: fatal error: 'Security/Security.h' file not found
warning: curl-sys@0.4.67+curl-8.3.0: #include <Security/Security.h>
warning: curl-sys@0.4.67+curl-8.3.0: ^~~~~~~~~~~~~~~~~~~~~
The fix there was to add this to my Nix shell:
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
I'm wondering if a similar invocation is needed here, for the Apple SDK frameworks in question?
Thanks, that seems to have partially solved the issue, but I'm still getting a compilation error:
error: failed to run custom build command for `media v0.1.0 (/Users/fischer/src/thirdparty/zed/crates/media)`
Caused by:
process didn't exit successfully: `/Users/fischer/src/thirdparty/zed/target/release/build/media-c45585ca0960e11f/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=src/bindings.h
cargo:rerun-if-env-changed=TARGET
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64-apple-darwin
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64_apple_darwin
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
--- stderr
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:250:151: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:252:157: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:238:167: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:241:179: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:43:121: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:45:117: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:50:183: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:52:179: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelFormatDescription.h:117:164: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:913:152: error: expected ','
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:915:81: error: expected ','
thread 'main' panicked at crates/media/build.rs:33:10:
unable to generate bindings: ClangDiagnostic("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:250:151: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:252:157: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:238:167: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:241:179: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:43:121: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:45:117: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:50:183: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:52:179: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelFormatDescription.h:117:164: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:913:152: error: expected ','\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:915:81: error: expected ','\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
It seems that there are still issues with the SDK. I've added the relevant ones from the error log with:
buildInputs = [
rust-bin.stable.latest.complete
postgresql_16
livekit
foreman
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
Security
SystemConfiguration
IOKit
CoreVideo
CoreMedia
]);
but still getting the aforementioned issue. Looks like something is wrong with the standard library somehow? I think this is the right track, will update if I figure anything out.
I was able to fix this by using the system installation of clang. No idea what the issue with clang in the nix store from this module is, and this solution isn't particularly satisfying, but here's a working nix flake:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}: flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
in with pkgs; {
devShells.default = mkShell {
# prioritize system clang
shellHook = ''
export PATH=/usr/bin:$PATH
'';
buildInputs = [
rust-bin.stable.latest.complete
postgresql_16
livekit
foreman
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
Security
]);
};
});
}
Check for existing issues
Describe the bug / provide steps to reproduce it
Building from source in release mode on aarch64-darwin gives me the following error:
My build dependencies (rust, postgres, livekit, foreman) are supplied from a flake in an impure nix shell, which makes me think this might be similar to #7016 and #6442, but the solution is not obvious to me from looking at those issues.
I've installed xcode and ran
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
, but I'm still getting the same issue.Clang info:
Cargo version:
cargo 1.75.0 (1d8b05cdd 2023-11-20)
Environment
Zed: v0.119.21 (Zed) OS: macOS 14.2.1 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.If you only need the most recent lines, you can run the
zed: open log
command palette action to see the last 1000.No response