zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
48.65k stars 2.92k forks source link

xcode error while building media #7036

Closed fbordwell closed 8 months ago

fbordwell commented 8 months ago

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:

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...
The following warnings were emitted during compilation:

warning: curl-sys@0.4.67+curl-8.3.0: curl/lib/macos.c:33:10: fatal error: 'SystemConfiguration/SCDynamicStoreCopySpecific.h' file not found
warning: curl-sys@0.4.67+curl-8.3.0: #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
warning: curl-sys@0.4.67+curl-8.3.0:          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: curl-sys@0.4.67+curl-8.3.0: 1 error generated.
warning: curl-sys@0.4.67+curl-8.3.0: ToolExecError: Command env -u IPHONEOS_DEPLOYMENT_TARGET "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-mmacosx-version-min=11.0" "-I" "curl/lib" "-I" "curl/include" "-I" "/Users/fischer/src/thirdparty/zed/target/release/build/libz-sys-fff8b075cc401bf0/out/include" "-fvisibility=hidden" "-DBUILDING_LIBCURL" "-DCURL_DISABLE_DICT" "-DCURL_DISABLE_GOPHER" "-DCURL_DISABLE_IMAP" "-DCURL_DISABLE_LDAP" "-DCURL_DISABLE_LDAPS" "-DCURL_DISABLE_POP3" "-DCURL_DISABLE_RTSP" "-DCURL_DISABLE_SMB" "-DCURL_DISABLE_SMTP" "-DCURL_DISABLE_TELNET" "-DCURL_DISABLE_TFTP" "-DCURL_STATICLIB" "-DENABLE_IPV6" "-DHAVE_ASSERT_H" "-DOS=\"unknown\"" "-DHAVE_ZLIB_H" "-DHAVE_LONGLONG" "-DHAVE_LIBZ" "-DHAVE_BOOL_T" "-DHAVE_STDBOOL_H" "-DHAVE_GETADDRINFO" "-DHAVE_GETPEERNAME" "-DHAVE_GETSOCKNAME" "-DCURL_DISABLE_NTLM" "-DCURL_DISABLE_FTP" "-DUSE_SECTRANSP" "-DHAVE_BUILTIN_AVAILABLE=1" "-DRECV_TYPE_ARG1=int" "-DHAVE_PTHREAD_H" "-DHAVE_ARPA_INET_H" "-DHAVE_ERRNO_H" "-DHAVE_FCNTL_H" "-DHAVE_NETDB_H" "-DHAVE_NETINET_IN_H" "-DHAVE_NETINET_TCP_H" "-DHAVE_POLL_H" "-DHAVE_FCNTL_O_NONBLOCK" "-DHAVE_SYS_SELECT_H" "-DHAVE_SYS_STAT_H" "-DHAVE_SYS_TIME_H" "-DHAVE_UNISTD_H" "-DHAVE_RECV" "-DHAVE_SELECT" "-DHAVE_SEND" "-DHAVE_SOCKET" "-DHAVE_STERRROR_R" "-DHAVE_SOCKETPAIR" "-DHAVE_STRUCT_TIMEVAL" "-DHAVE_SYS_UN_H" "-DUSE_THREADS_POSIX" "-DUSE_UNIX_SOCKETS" "-DRECV_TYPE_ARG2=void*" "-DRECV_TYPE_ARG3=size_t" "-DRECV_TYPE_ARG4=int" "-DRECV_TYPE_RETV=ssize_t" "-DSEND_QUAL_ARG2=const" "-DSEND_TYPE_ARG1=int" "-DSEND_TYPE_ARG2=void*" "-DSEND_TYPE_ARG3=size_t" "-DSEND_TYPE_ARG4=int" "-DSEND_TYPE_RETV=ssize_t" "-DSIZEOF_CURL_OFF_T=8" "-DSIZEOF_INT=4" "-DSIZEOF_SHORT=2" "-D__APPLE__" "-DHAVE_MACH_ABSOLUTE_TIME" "-DSIZEOF_SSIZE_T=8" "-DSIZEOF_SIZE_T=8" "-DSIZEOF_LONG=8" "-o" "/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-6396ad9112614206/out/build/curl/lib/macos.o" "-c" "curl/lib/macos.c" with args "clang" did not execute successfully (status code exit status: 1).running: env -u IPHONEOS_DEPLOYMENT_TARGET "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-mmacosx-version-min=11.0" "-I" "curl/lib" "-I" "curl/include" "-I" "/Users/fischer/src/thirdparty/zed/target/release/build/libz-sys-fff8b075cc401bf0/out/include" "-fvisibility=hidden" "-DBUILDING_LIBCURL" "-DCURL_DISABLE_DICT" "-DCURL_DISABLE_GOPHER" "-DCURL_DISABLE_IMAP" "-DCURL_DISABLE_LDAP" "-DCURL_DISABLE_LDAPS" "-DCURL_DISABLE_POP3" "-DCURL_DISABLE_RTSP" "-DCURL_DISABLE_SMB" "-DCURL_DISABLE_SMTP" "-DCURL_DISABLE_TELNET" "-DCURL_DISABLE_TFTP" "-DCURL_STATICLIB" "-DENABLE_IPV6" "-DHAVE_ASSERT_H" "-DOS=\"unknown\"" "-DHAVE_ZLIB_H" "-DHAVE_LONGLONG" "-DHAVE_LIBZ" "-DHAVE_BOOL_T" "-DHAVE_STDBOOL_H" "-DHAVE_GETADDRINFO" "-DHAVE_GETPEERNAME" "-DHAVE_GETSOCKNAME" "-DCURL_DISABLE_NTLM" "-DCURL_DISABLE_FTP" "-DUSE_SECTRANSP" "-DHAVE_BUILTIN_AVAILABLE=1" "-DRECV_TYPE_ARG1=int" "-DHAVE_PTHREAD_H" "-DHAVE_ARPA_INET_H" "-DHAVE_ERRNO_H" "-DHAVE_FCNTL_H" "-DHAVE_NETDB_H" "-DHAVE_NETINET_IN_H" "-DHAVE_NETINET_TCP_H" "-DHAVE_POLL_H" "-DHAVE_FCNTL_O_NONBLOCK" "-DHAVE_SYS_SELECT_H" "-DHAVE_SYS_STAT_H" "-DHAVE_SYS_TIME_H" "-DHAVE_UNISTD_H" "-DHAVE_RECV" "-DHAVE_SELECT" "-DHAVE_SEND" "-DHAVE_SOCKET" "-DHAVE_STERRROR_R" "-DHAVE_SOCKETPAIR" "-DHAVE_STRUCT_TIMEVAL" "-DHAVE_SYS_UN_H" "-DUSE_THREADS_POSIX" "-DUSE_UNIX_SOCKETS" "-DRECV_TYPE_ARG2=void*" "-DRECV_TYPE_ARG3=size_t" "-DRECV_TYPE_ARG4=int" "-DRECV_TYPE_RETV=ssize_t" "-DSEND_QUAL_ARG2=const" "-DSEND_TYPE_ARG1=int" "-DSEND_TYPE_ARG2=void*" "-DSEND_TYPE_ARG3=size_t" "-DSEND_TYPE_ARG4=int" "-DSEND_TYPE_RETV=ssize_t" "-DSIZEOF_CURL_OFF_T=8" "-DSIZEOF_INT=4" "-DSIZEOF_SHORT=2" "-D__APPLE__" "-DHAVE_MACH_ABSOLUTE_TIME" "-DSIZEOF_SSIZE_T=8" "-DSIZEOF_SIZE_T=8" "-DSIZEOF_LONG=8" "-o" "/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-6396ad9112614206/out/build/curl/lib/mqtt.o" "-c" "curl/lib/mqtt.c"
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:          ^~~~~~~~~~~~~~~~~~~~~
warning: curl-sys@0.4.67+curl-8.3.0: 1 error generated.
warning: curl-sys@0.4.67+curl-8.3.0: ToolExecError: Command env -u IPHONEOS_DEPLOYMENT_TARGET "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-mmacosx-version-min=11.0" "-I" "curl/lib" "-I" "curl/include" "-I" "/Users/fischer/src/thirdparty/zed/target/release/build/libz-sys-fff8b075cc401bf0/out/include" "-fvisibility=hidden" "-DBUILDING_LIBCURL" "-DCURL_DISABLE_DICT" "-DCURL_DISABLE_GOPHER" "-DCURL_DISABLE_IMAP" "-DCURL_DISABLE_LDAP" "-DCURL_DISABLE_LDAPS" "-DCURL_DISABLE_POP3" "-DCURL_DISABLE_RTSP" "-DCURL_DISABLE_SMB" "-DCURL_DISABLE_SMTP" "-DCURL_DISABLE_TELNET" "-DCURL_DISABLE_TFTP" "-DCURL_STATICLIB" "-DENABLE_IPV6" "-DHAVE_ASSERT_H" "-DOS=\"unknown\"" "-DHAVE_ZLIB_H" "-DHAVE_LONGLONG" "-DHAVE_LIBZ" "-DHAVE_BOOL_T" "-DHAVE_STDBOOL_H" "-DHAVE_GETADDRINFO" "-DHAVE_GETPEERNAME" "-DHAVE_GETSOCKNAME" "-DCURL_DISABLE_NTLM" "-DCURL_DISABLE_FTP" "-DUSE_SECTRANSP" "-DHAVE_BUILTIN_AVAILABLE=1" "-DRECV_TYPE_ARG1=int" "-DHAVE_PTHREAD_H" "-DHAVE_ARPA_INET_H" "-DHAVE_ERRNO_H" "-DHAVE_FCNTL_H" "-DHAVE_NETDB_H" "-DHAVE_NETINET_IN_H" "-DHAVE_NETINET_TCP_H" "-DHAVE_POLL_H" "-DHAVE_FCNTL_O_NONBLOCK" "-DHAVE_SYS_SELECT_H" "-DHAVE_SYS_STAT_H" "-DHAVE_SYS_TIME_H" "-DHAVE_UNISTD_H" "-DHAVE_RECV" "-DHAVE_SELECT" "-DHAVE_SEND" "-DHAVE_SOCKET" "-DHAVE_STERRROR_R" "-DHAVE_SOCKETPAIR" "-DHAVE_STRUCT_TIMEVAL" "-DHAVE_SYS_UN_H" "-DUSE_THREADS_POSIX" "-DUSE_UNIX_SOCKETS" "-DRECV_TYPE_ARG2=void*" "-DRECV_TYPE_ARG3=size_t" "-DRECV_TYPE_ARG4=int" "-DRECV_TYPE_RETV=ssize_t" "-DSEND_QUAL_ARG2=const" "-DSEND_TYPE_ARG1=int" "-DSEND_TYPE_ARG2=void*" "-DSEND_TYPE_ARG3=size_t" "-DSEND_TYPE_ARG4=int" "-DSEND_TYPE_RETV=ssize_t" "-DSIZEOF_CURL_OFF_T=8" "-DSIZEOF_INT=4" "-DSIZEOF_SHORT=2" "-D__APPLE__" "-DHAVE_MACH_ABSOLUTE_TIME" "-DSIZEOF_SSIZE_T=8" "-DSIZEOF_SIZE_T=8" "-DSIZEOF_LONG=8" "-o" "/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-6396ad9112614206/out/build/curl/lib/vtls/sectransp.o" "-c" "curl/lib/vtls/sectransp.c" with args "clang" did not execute successfully (status code exit status: 1).

error: failed to run custom build command for `curl-sys v0.4.67+curl-8.3.0`

Caused by:
  process didn't exit successfully: `/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-30edf85a0057966a/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=curl
  OPT_LEVEL = Some("3")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("clang")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  RUSTC = Some("rustc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rustc-link-lib=clang_rt.osx
  cargo:rustc-link-search=/nix/store/65lhhpbfnsf9b3knd4q2l49y7107fisp-clang-wrapper-16.0.6/resource-root/lib/darwin
  cargo:root=/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-6396ad9112614206/out
  cargo:include=/Users/fischer/src/thirdparty/zed/target/release/build/curl-sys-6396ad9112614206/out/include
  cargo:static=1
  cargo:rustc-cfg=libcurl_vendored
  cargo:rustc-cfg=link_libz
  /Applications/Xcode.app/Contents/Developer
  xcode version: Xcode 15.2
  Build version 15C500b

  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("clang")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  RUSTC = Some("rustc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None

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:

clang version 16.0.6
Target: aarch64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /nix/store/a4zdkdhr7wfdv55q9bv293grng7c3gf6-clang-16.0.6/bin

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

fbordwell commented 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
maxdeviant commented 8 months ago

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
  ];

https://github.com/maxdeviant/peacock/blob/be967bede9f1d73b32bac6e6f9aa3b5023e90743/shell.nix#L11-L13

I'm wondering if a similar invocation is needed here, for the Apple SDK frameworks in question?

fbordwell commented 8 months ago

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.

fbordwell commented 8 months ago

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
      ]);
    };
  });
}