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

Xcode 15.3 RC Release Notes mention:

Fixed a bug where creating an xcframework from a framework or library located at a path containing a symlink (such as /var which is a symlink to /private/var) would fail. (115786062) (FB13191683)

A fix? Sounds exactly like this, I presume… :raised_hands:

Yeah, I saw that a few weeks ago with the beta! That is exactly it. Thanks for posting that here.