2

I'm working on a SFML app for macOS with the latest Xcode version.

I got a "Command CodeSign failed with a nonzero exit code" error when it tries to sign the SFML frameworks. I added these under "Link Binary with Libraries" and "Copy Files" in Target, under Build Phases. Before, I was working with my local frameworks under /Library/Frameworks, and it was working very well.

Now I need to create an archive .app. I've tried a lot of things seen on other posts here (like lock and unlock my keychains), but nothing worked. Still got that error.

My SFML Frameworks in "Link Binary with Libraries" "Link Binary with Libraries"

/Users/lounesksouri/Library/Developer/Xcode/DerivedData/Squadro-gqwjbvsooypqaifxxyzhdrahkdpo/Build/Intermediates.noindex/ArchiveIntermediates/Squadro/InstallationBuildProductsLocation/Applications/Squadro.app/Contents/Frameworks/sfml-system.framework/Versions/A: bundle format unrecognized, invalid, or unsuitable

Command CodeSign failed with a nonzero exit code

8
  • Do you have your framework under the Embed Frameworks area? check this stackoverflow.com/a/52787285/1040347 Commented Dec 9, 2019 at 17:42
  • @AlekseyPotapov I had seen this post, and I think the "Frameworks, Libraries, and Embedded Content" under General tab is quite the same thing (as in my Xcode version, there's not "Embed Framework" area in the Builder Phases tab), so yes all my frameworks are listed in this section... Commented Dec 9, 2019 at 17:57
  • To make sure, do you have under Targets/Build Phases/Embedded Frameworks your sfml frameworks? Commented Dec 9, 2019 at 18:01
  • Did you try to delete Derived Data under ~/Library/Developer/Xcode/DerivedData/ ? (xcode should be closed) via terminal command rm -rf ~/Library/Developer/Xcode/DerivedData/* Commented Dec 9, 2019 at 18:04
  • @AlekseyPotapov yes, I did try a lot of times to delete Derived Data. And I don't have the Targets/Build Phases/Embedded Frameworks section Commented Dec 9, 2019 at 18:34

3 Answers 3

4

Ok, I solved my problem, after long hours.

It's a lot more simple to use the script already present in Build Phases tab, generated if you use the SFML App Xcode template (see here the original script). I had tried it at first, but it didn't work so I let it down.

But, in this script, the first three lines are not the good ones, for a normal SFML installation on macOS. We need to modify these lines with the good paths to the Frameworks and lib folders, as follows :

SFML_DEPENDENCIES_INSTALL_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_FRAMEWORK_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_LIB_PREFIX="/usr/local/lib"
FRAMEWORKS_FULL_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/"

Secondly, there is still the code signing problem : the archive will created but we will get an error if we start the .app. The solution to this problem is to check Disable Library Validation under Target/Signing & Capabilities to allow the application to load plug-ins or frameworks signed by other developers.

Finally, if we create the archive and launch the application, everything goes normally, as planned.

Sign up to request clarification or add additional context in comments.

2 Comments

This part helped me a lot, for the code signing I just resigned the SFML libs with my identity. (see my answer below)
Thank you. There is one more thing that you may need to change if still have the problem. Under the Build Settings->Other Code Signing Flags put --deep for Any SDK variant for the version selected (Debug or Release)
0

I faced this problem with the new update of Xcode. I was reading your discussion, and did some accidental modifications. I am definetely not an expert but what I did fixed the problem so I did not receive tgis error anymore. So I added the sfml libraries (5 libraries), whose paths are written in build settings -> framework swarch paths. And this adding automatically added them in Embedded Frameworks under the Build phases section. What I did is unchecking the checkboxes of all 5 libraries "Code sign On copy". Thank you guys for giving me the path for "solving" the problem :))))

2 Comments

You're welcome, don't forget to upvote if the answer worked for you 😁
This act dont permit to trust your device and your app doesnt installed..
0

For the Code-signing issue:

  1. Open a Terminal,
  2. Go to the Framework folder (cd /Library/Frameworks) and sing them.
  3. choose your identity
security find-identity -vp codesigning
  1. sign them Frameworks!
codesign -s AD90FAFAFAFAFAFAFAF-YOURHASH-9D6 ogg.framework
codesign ... all the others
  1. run and enjoy!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.