Xcodebuild -create-xcframework not working in Xcode 15.0

Hello! Not really a Swift question, but I thought someone here may have an answer. I have found a weird behavior change when running xcodebuild -create-xcframework in Xcode 15 compared to running it in Xcode 14.3.1. If I run the command like this in Xcode 15:

xcodebuild 
-create-xcframework 
-framework "pathToFrameworkInATemporaryDirectory"
-debug-symbols "pathToDebugSymbols" 
-output "Something.xcframework"

I get this error:

error: cannot compute path of binary 'Path(str: "temporaryPathToTheUnixExecutableFile")' relative to that of 'temporaryPathToTheFramework'

But if I trace that path to the unix executable file, it is present.

If I run that same command in Xcode 14.3.1, it works fine.

I can create the xcframework successfully in Xcode 15 if I don't copy the framework to a temporary directory before calling xcodebuild -create-xcframework and I use that original path.

Why is this problem happening now in Xcode 15?

Any help is appreciated, thank you.

3 Likes

We were running into the same issue and found that this seems to happen only if there are symlinks in the paths given to -create-xcframework.

We were able to work around this by resolving the symlinks with readlink like this:

xcodebuild 
-create-xcframework 
-framework $(readlink -f "pathToFrameworkInATemporaryDirectory")
-debug-symbols $(readlink -f "pathToDebugSymbols")
-output $(readlink -f "Something.xcframework")

We were using the following build command with xcode 14.3:

xcodebuild -create-xcframework \
    -framework $PROJECT_DIR/../devices/Build/Intermediates.noindex/ArchiveIntermediates/myFramework/BuildProductsPath/Release-iphoneos/myFramework.framework \
   -framework $PROJECT_DIR/../simulators/Build/Intermediates.noindex/ArchiveIntermediates/myFramework/BuildProductsPath/Release-iphonesimulator/myFramework.framework \
  -output $PROJECT_DIR/../output/myFramework.xcframework

And we are experiencing the same issue with xCode 15. How can we solve this?

We resolved it by using the canonical path that points to our temporary directory and that worked.

More information about that here.

1 Like