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
47.64k stars 2.78k forks source link

MacOS/XCode Beta: Building fails, can't find libdispatch headers. #12947

Open TeamPuzel opened 3 months ago

TeamPuzel commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

error: failed to run custom build command for `gpui v0.1.0 (/Users/teampuzel/OpenSource/zed/crates/gpui)`

Caused by:
  process didn't exit successfully: `/Users/teampuzel/OpenSource/zed/target/debug/build/gpui-b5ec5dae60ae581a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-lib=framework=System
  cargo:rerun-if-changed=src/platform/mac/dispatch.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
  src/platform/mac/dispatch.h:1:10: fatal error: 'dispatch/dispatch.h' file not found
  thread 'main' panicked at crates/gpui/build.rs:66:14:
  unable to generate bindings: ClangDiagnostic("src/platform/mac/dispatch.h:1:10: fatal error: 'dispatch/dispatch.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

This has been happening to me for a month or so and makes it impossible to fix bugs that I find :(

I also tried using this variable but it did not help:

export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --show-sdk-path)"

The output is:

22:25 zed > xcrun --show-sdk-path
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

Environment

Zed: v0.140.0 (Zed Preview) OS: macOS 15.0.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

N/A

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

N/A

SomeoneToIgnore commented 3 months ago

Looks like https://github.com/zed-industries/zed/issues/11963 , does it help?

TeamPuzel commented 3 months ago

No, I did try exporting the variable as I mentioned, it still doesn't build

notpeter commented 3 months ago

@TeamPuzel I didn't catch that this on was on the MacOS 15.0.0 Preview (Sequoia).

We haven't done much testing with that yet (or else we might have run into this).

TeamPuzel commented 3 months ago

I think It was happening before the beta too. In both cases I had Xcode-beta installed rather than the release Xcode, could that be a problem?

notpeter commented 3 months ago

I think It was happening before the beta too. In both cases I had Xcode-beta installed rather than the release Xcode, could that be a problem?

I have no idea! But it's certainly good to know. I had also missed that in the description you provided above. Thanks for explicitly calling it out.

TeamPuzel commented 3 months ago

I tried it again, it also seems to run into another (maybe related) issue:

error: failed to run custom build command for `live_kit_client v0.1.0 (/Users/teampuzel/OpenSource/zed/crates/live_kit_client)`

Caused by:
  process didn't exit successfully: `/Users/teampuzel/OpenSource/zed/target/debug/build/live_kit_client-21715046118e1154/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET
  cargo:rerun-if-changed=LiveKitBridge/Sources
  cargo:rerun-if-changed=LiveKitBridge/Package.swift
  cargo:rerun-if-changed=LiveKitBridge/Package.resolved

  --- stderr
  error: 'livekitbridge': Invalid manifest (compiled with: ["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/tf/zch6121s4wd8hv092csrhrth0000gn/T/TemporaryDirectory.Cgd22u/vfs.yaml", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-target", "arm64-apple-macosx13.0", "-sdk", "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk", "-F", "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-I", "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-L", "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-swift-version", "5", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk", "-package-description-version", "5.5.0", "/Users/teampuzel/OpenSource/zed/crates/live_kit_client/LiveKitBridge/Package.swift", "-o", "/var/folders/tf/zch6121s4wd8hv092csrhrth0000gn/T/TemporaryDirectory.E9Ouaz/livekitbridge-manifest"])
  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-macos.swiftinterface:3700:119: error: 'Failure' is only available in macOS 9999 or newer
   3683 | public struct AsyncLineSequence<Base> : _Concurrency.AsyncSequence where Base : _Concurrency.AsyncSequence, Base.Element == Swift.UInt8 {
   3684 |   public typealias Element = Swift.String
   3685 |   public struct AsyncIterator : _Concurrency.AsyncIteratorProtocol {
        |                 `- note: add @available attribute to enclosing struct
   3686 |     public typealias Element = Swift.String
   3687 |     #if compiler(>=5.3) && $NoncopyableGenerics
        :
   3698 |     #if compiler(>=5.3) && $AssociatedTypeImplements
   3699 |     @available(iOS 18.0, tvOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)
   3700 |     @_implements(_Concurrency.AsyncIteratorProtocol, Failure) public typealias __AsyncIteratorProtocol_Failure = Base.Failure
        |                                                                                                                       `- error: 'Failure' is only available in macOS 9999 or newer
   3701 |     #else
   3702 |     @available(iOS 18.0, tvOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)

This is odd, it's using swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain (why?) and at the same time paths to Xcode, which would have libraries for a different version of Swift. How can I get it to use the Xcode Swift for this?