To use codesign on an older machines with an older version of Xcode add the -generate-entitlement-der flag to your call to codesign.
This additional DER encoded entitlements section is required in iOS 15 and becomes the default behavior of codesign in the latest Xcode. codesign -generate-entitlement-derĪpple has changed the codesign signature to include DER encoded entitlements in addition to the plist encoded entitlements. The only reason to use 12.4 would be because you're stuck on Catalina and new problems are cropping up that will not be worked around so easily. If you're still using an Xcode 12 release it is time to let go. Probably cruft of some kind in your project. If you are using a recent Xcode 13+ this is not your issue. My build farm was for a time stuck at Xcode 12.4 because some Mac minis couldn't be upgraded past Catalina. This answer is mostly for people using older versions of Xcode.