Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CommonCrypto isn't building for arch armv7 iOS

Tags:

xcode

ios

armv7

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

like image 694
iosfreak Avatar asked Sep 22 '12 21:09

iosfreak


2 Answers

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

like image 92
Heider Sati Avatar answered Nov 01 '22 17:11

Heider Sati


I just solved this as follows:

It turns out that the libcommonCrypto.dylib error was a red herring.

After removing libcommonCrypto.dylib as suggested above, I got 9 new errors. At first glance, I assumed they were Crypto errors, but in fact they were not; for me, it actually traced back to zLib not being included, which was "imported" in a deeper part of the overall implementation (of which crypto is a part).

For me specifically, it traced back to ASIDataDecompressor.h, #import < zlib.h>

I fixed it by including the missing libz.dylib framework; ultimately, I did not have to explicitly include libcommonCrypto.dylib.

So, be sure to check the errors closely after toggling libcommonCrypto, and make sure some OTHER libraries are not missing, instead.

like image 34
eGanges Avatar answered Nov 01 '22 16:11

eGanges