Duplicated Signature when archiving a multi platform project

Hey all,

I am facing a weird issue when exporting my multi platform project. The project does not make use of the multi platform targets of Xcode yet. For each "module" in the app there exists two targets, one for iOS and one for watchOS. Each of these targets link agains a binary framework that is imported via SPM.

Building works fine but as soon as I want to archive the project at the last step it complains that the Signature for the third party binary framework already exists. Which I think is a valid error message, but it seems to be a bug that the archive process either:

  • Does not override it, which would be reasonable
  • Or it should distinguish between the platforms
  • Or should just not create two signature and just have one signature file created

The error message I see

“ThirdParty.xcframework.signature” couldn’t be copied to “Signatures” because an item with the same name already exists.
Domain: NSCocoaErrorDomain Code: 516
Failure Reason: A file with the name “ThirdParty.xcframework.signature” already exists. Recovery Suggestion: To save the file, either provide a different name, or move aside or delete the existing file, and try again.

-- The operation couldn’t be completed. File exists Domain: NSPOSIXErrorDomain Code: 17 Failure Reason: File exists
-- System Information 
macOS Version 13.4.1 (Build 22F82)
Xcode 15.0 (22221.2) (Build 15A5195k)
Timestamp: 2023-07-08T12:43:57+02:00

A simplified project setup is like the following.

┌──────────────────────────────────────────────┐
│                 SPM Package                  │
│                                              │
│         ┌────────────────────────┐           │
│         │ ThirdParty.xcframework │           │
│         └────────────────────────┘           │
│                      │                       │
└──────────────────────┼───────────────────────┘
          ┌────────────┴───────────┐            
┌─────────┼────────────────────────┼───────────┐
│         │      CoreFramework     │           │
│         ▼                        ▼           │
│ ┌───────────────┐       ┌────────────────┐   │
│ │  iOS Target   │       │ watchOS Target │   │
│ └───────────────┘       └────────────────┘   │
│         │                        │           │
└─────────┼────────────────────────┼───────────┘
          │                        │            
          │                        │            
          │                        │            
          │                        ▼            
          │   Embedded in  ┌───────────────┐    
          │      (not  ┌───│  watchOS App  │    
          │   standalone)  └───────────────┘    
          │            │                        
          │            │                        
          │            │                        
          │            │                        
          ▼            │                        
 ┌─────────────────┐   │                        
 │     iOS App     │◀──┘                        
 └─────────────────┘                                  

I have the feeling it's rather a beta bug, but I wanted to ensure that's the case and its not me doing something wrong.

Does anyone know if this setup is correct or if there is something I oversee here ?

Any help is highly appreciated !

Feedback is also filed under: FB12373687

Post not yet marked as solved Up vote post of alexanderwe Down vote post of alexanderwe
4.7k views

Replies

I use binary .xcframeworks for multiple internal libraries too, but that´s happening only in one of them. I can reproduce in Xcode 15.0 beta 2.

I am seeing this same issue in Xcode 15 beta 4, though I am importing an xcframework directly rather than using SPM.

Does anyone have a reproducible test project? I can try to generate one. This is really blocking our iOS17 migration process.

Here your can find a really simple project that reproduces the problem:

https://github.com/osrufung/DuplicatedSignatureXcode15IssueDemoProject

Seeing this issue when using an xcframework in a macOS project (the xcframework is linked from both another framework, and from the containing app). This used to work fine in Xcode 14 and earlier.

I can still reproduce this issue under Xcode 15.0 Beta 5, seems like it was not fixed yet

We can finally build to devices for debugging with Xcode 15 beta 5, but i wanted to hop on this thread and say we are seeing the same issue. We are duping this feedback.

Feedback is also filed under: FB12373687

Thanks for filing that.

I took a quick look and your bug has definitely made it to the right place. I don’t have any other info to share, other than the generic recommendation that you should continue testing with new Xcode betas as they are released and update your bug report with your results.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@eskimo Great to hear the feedback reached the right place! I will continue checking with each new beta and monitoring the feedback.

@alexanderwe Can you confirm you´re using Cocoapods in your project?

I found a fix for my demo project based in removing the customization on the CONFIGURATION_BUILD_DIR variable that CP does in the Module.release.xcconfig file.


CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
# This generates a duplication in the framework generation as you can see in the attached image
# CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Library1
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift

@oswaldo I do not use Cocoapods, I am using SPM to integrate my dependencies, where I currently assume this should work out of the box - at least I do not know what could cause this issues I have. I can also not find CONFIGURATION_BUILD_DIR within my Xcode project :(

@alexanderwe ok, good to know. Probably this situation is also reproducible in other scenarios. Can you check in your logs, this "Process Framework.xcframework" line in the Prepare build step is duplicated too?

Still broken in beta 6. As a workaround, I’ve now resorted to manually deleting the conflicting signature during the build process after the first time it’s copied and before the second.

To elaborate on the workaround suggested by @sotkov (thank you!), the following shell script phase got us unblocked (as of beta 6).

if [ "$XCODE_VERSION_MAJOR" = "1500" ]; then
  echo "Remove signature files (Xcode 15 beta 6 workaround)"

  rm "$BUILD_DIR/Release/framework.xcframework-macos.signature"
  ...repeat for other .signature files...
fi

For me Xcode 15 Beta 6 is fixing the issue. It's working in the mentioned setup and I do not face the duplicated signature issue any longer.

@oswaldo I do not see any duplicated process steps in my build logs any longer in Beta 6.

@ksuther I see this a macOS project ? For this I did not try it yet, since the project is mobile only atm.