copy on code sign, where does version come from?

I have a framework that I am trying to embed in an application.

The framework uses cmake to build itself, and I can rebuild as needed to fix this problem.

When I include the library in my application, with Code Sign On Copy checked, the step fails with a file not found. Tracing the output, it is trying to sign a library at Versions/A. The library should have a version of 1.10.0, and when doing otool it reports the version numbers as 1.10.0.

So, where does xcode get that A for the version when trying to sign the library? What can be changed so it has the right version number?

Answered by DTS Engineer in 713667022

did you ever find a solution to this problem?

While Xcode could handle this better, and the bug referenced above (r. 37784591) is still open, the best solution to this problem is to build your Mac framework with a single version called A. We recently published Placing Content in a Bundle, where the Support a Single Framework Version on macOS section is crystal clear about this:

best practice is to use a single version named A.

Moving forward support for multiple versions, and non-standard version numbers, is going to get less and less reliable. I strongly encourage you to update your frameworks to follow this best practice. And if you’re working with a framework from another third-party developer, ask their support channel why they are not doing this.

Share and Enjoy

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

Lemme get this straight, your framework looks like a standard framework:

***.framework/
***.framework/Resources -> Versions/Current/Resources
***.framework/*** -> Versions/Current/***
***.framework/Versions/
***.framework/Versions/Current -> A
***.framework/Versions/A
***.framework/Versions/A/Resources/
***.framework/Versions/A/Resources/Info.plist
***.framework/Versions/A/***

except that everywhere I’ve written

A
you have
1.10.0
. Is that right?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

That is correct.

The A should be 1.10.0. The framework looks like the above where all the A's are 1.10.0.


But the sign action tries to sign a (non-existent) Versions/A directory.

otool only shows 1.10.0, no A anywhere. I don't know where else to look. The directory looks right, the build project has the various versions set to 1.10.0, but something somewhere still seems to want it to be version A.


And yes, 1.10.1 is not compatible. Thus the 1.10.0 for compatible version for this library. This is a cross platform library built as framework for OSX and iOS, and the version tag is what it is to cover all platforms.

This is a cross platform library built as framework for OSX and iOS, and the version tag is what it is to cover all platforms.

Yeah, I thought you might be heading in that direction. What’s your deployment target for this framework? These days most macOS products (and all products on iOS-based platforms) are self contained. As such, there’s no point have multiple versions of the code nested within your framework, because the framework is embedded within an app that contains all of its client code.

Moreover doing this is actively harmful:

  • It makes the framework bigger than necessary.

  • It puts you well off the beaten path, as you’ve discovered here.

Regardless, if you want to keep going down with path you should check out the

--bundle-version
option to
codesign
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Your last post is totally unhelpful.

I don't need to reduce the library file size. I just need to get this version of the framework to include properly in my application. Using 1.10.0 instead of A or B doesn't increase size appreciably. There has to be a way to pick B, unless Apple has just dropped all support for framework compatiblity. And if that is the case, how is it handled when an App uses frameworks F1(Ver B) and F2(Ver A), where framework F2 uses F1(Ver A)?



The current target is an OSX application, which is trying to embed the osx framework of the library.

The frameworks also have an iOS flavor, and I have an iOS version of the application in work too. I'm expecting to use this information for that as well.



I said that the library doesn't use A as the framework version identifier. And that the project option sign on copy does not work when trying to embed the library that is produced.

If the libraries were to update incompatibly, should it keep using a framework version A because it's going to be an embedded framework?



When the library generates it's output, it creates what looks to be a perfectly valid framework comprising of exactly one version of that framework.


XYZ.framework/Versions/1.10.0/....

XYZ.framework/Versions/Current -> 1.10.0

XYZ.framework/Headers -> Versions/1.10.0/Headers

XYZ.framework/Resources-> Versions/1.10.0/Resources

XYZ.framework/XYZ-> Versions/1.10.0/XYZ



There is more than just one framework

No other versions included in the framework folders besides the 1.10.0 for these. So, I am not trying to pick an old version of the framework while having later versions available. It's the only version.



For the area in the project, it is an embedded framework with a checkmark to sign on copy.

There is no place to add a bundle version. That's what I want to know how to do.



Including these frameworks in another project, the sign on copy fails with directory not found .../Versions/A.

Of course not, there isn't a Versions/A. Where does Versions/A come from? What do I fix in the library or the inclusion of the framework so xcode knows the version is 1.10.0?


If it has to always be A, how do you support breaking API changes in a framework that might get embedded?

To be clear.

I didn't write the frameworks. I am trying to incorporate frameworks that are available in source form. I am willing to fix either the framework or my inclusion so it includes properly. The version number identifier was selected by those that provide the framework. I am just trying to make it work.


The frameworks pass all codesign verifications. The only problem is that xcode tries to sign the wrong location when sign on copy is checked. That is what I am trying to fix.

I'm hitting the same problem as StarGazerI. I have a private framework that just has a single version of 1. Xcode throws an error while trying to sign Versions/A, which does not exist. This happens when "Code Sign On Copy" is checked in a Copy Files Build Phase.


If I copy the failing codesign command and run it in Terminal on the same framework, it works if I use:


/usr/bin/codesign --force --sign mykey --preserve-metadata=identifier,entitlements,flags --timestamp=none /Users/karl/Library/Developer/Xcode/DerivedData/CreateInstance-fzlvjftxqybywnftwjerjoginndb/Build/Products/Debug/foo.framework/Versions/1


or


/usr/bin/codesign --force --sign mykey --preserve-metadata=identifier,entitlements,flags --timestamp=none /Users/karl/Library/Developer/Xcode/DerivedData/CreateInstance-fzlvjftxqybywnftwjerjoginndb/Build/Products/Debug/foo.framework


It seems that Xcode is intent on expecting a Version/A in the framework, which is not strictly required according to the various Frameworks and codesign documentation.


Does anyone know how to coerce Xcode to use the right (Current) version?

I strongly recommend that you name your framework version

A
rather than
1
. If there’s some compelling reason you can’t do that, you should open a DTS tech support incident so one of our tools folks can look into getting Xcode to accommodate that.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Bug report 37784591 filed.

I have the same issue. I have a QT application with QT frameworks with single version of 5.

I have exactly the same problem with Qt frameworks, they have Versions/5 instead of /Versions/A

In an earlier post it was asked how to coerce Xcode to use the right (Current) version?

Apple's Code Signing Guide says:
Important: When you manually code sign a framework, only the current version, the one pointed at by the Versions/Current symbolic link, is signed by default.

Why Xcode does not follow this?

StarGazerI, I know this is late, but did you ever find a solution to this problem?

did you ever find a solution to this problem?

While Xcode could handle this better, and the bug referenced above (r. 37784591) is still open, the best solution to this problem is to build your Mac framework with a single version called A. We recently published Placing Content in a Bundle, where the Support a Single Framework Version on macOS section is crystal clear about this:

best practice is to use a single version named A.

Moving forward support for multiple versions, and non-standard version numbers, is going to get less and less reliable. I strongly encourage you to update your frameworks to follow this best practice. And if you’re working with a framework from another third-party developer, ask their support channel why they are not doing this.

Share and Enjoy

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

copy on code sign, where does version come from?
 
 
Q