CommonCrypto isn't building for arch armv7 iOS

iosfreak picture iosfreak · Sep 22, 2012 · Viewed 8.9k times · Source

I recently just upgraded to the new XCode. After I upgraded, some of my apps won't build. I get this error:

ld: cannot link directly with /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system/libcommonCrypto.dylib.  Link against the umbrella framework 'System.framework' instead. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've tried everything - cleaning, reimporting, changing architectures...

Please help

Answer

Heider Sati picture Heider Sati · Nov 6, 2013

I resolved this issue in a diffent way after I tried both the above where neither worked for me.

The problem was that when I was adding the library from the main interface (main build-settings...etc) I was searching initially for crypto and then two libs comes back libcorecrypto.dylib and liblibcommonCrypto.dylib, if you notice, both exists in gray-color unlike the usually yello-colored libs that you normally add. Adding these causes the compiler to report back (some other libs are missing, such as the libz, or another lib that will be needed the more functions you take on.

If you notice the above two libs would normally sit under JavaScriptCore.framework library (which is the yellow one), therefore, by removing the above two and adding JavaScriptCore.framework instead, the problem was resolved, and build successful showed

Also to mention that based on the gray-libs existing as a bundle inside JavaScriptCore.framework, the libcrypto and the other one will not exists under the /Library/.../system/path as mentioned above, i.e. you didn't delete them from your system, they're just not there.

Again, the solution is:

*From your main XCODE project settings, don't add:*dd

libcorecrypto.dylib 
liblibcommonCrypto.dylib

Instead, add:

JavaScriptCore.framework

In your .m (code), just source them normally by doing:

#include <CommonCrypto/CommonDigest.h> (or any of your other libs as needed in code)...

It should work fine.

I hope this helps.

Kind Regards