Having a strange problem here that involves Xcode, but might not be an Xcode issue per se.
I'm working on a project using https://github.com/tuist/XcodeGraph which eventually calls swift package ... dump-package
within its run. When calling this from the command line, everything works fine.
When calling it as a part of an Xcode build phase, it errors out with something like that:
swcompression': Invalid manifest (compiled with: ["/Applications/Xcode-16.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/pd/3572xtbd5bscn2h3ylb8cys00000gn/T/TemporaryDirectory.GbrNld/vfs.yaml", "-L", "/Applications/Xcode-16.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Applications/Xcode-16.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-target", "arm64-apple-macosx13.0", "-sdk", "/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.2.sdk", "-F", "/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-I", "/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-L", "/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib", "-swift-version", "5", "-I", "/Applications/Xcode-16.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.2.sdk", "-package-description-version", "5.3.0", "/Volumes/Samsung/Documents/late/network/iOS/NetworkLab/NetworkLab/Dependencies/.build/checkouts/SWCompression/Package.swift", "-o", "/var/folders/pd/3572xtbd5bscn2h3ylb8cys00000gn/T/TemporaryDirectory.aFPe7h/swcompression-manifest"])
<unknown>:0: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'
<unknown>:0: error: unable to load standard library for target 'arm64-apple-macosx13.0'
error: invalid manifests at [<AbsolutePath:"/Volumes/Samsung/Documents/late/network/iOS/NetworkLab/NetworkLab/Dependencies/.build/checkouts/SWCompression">]
Since Xcode is setting an enormous amount of environment variables before calling such scripts, I replicated these, but it still works from the command line.
I'm completely out of my depth how to debug this. Could this be a race condition? Does this error message ring a bell for anyone?