CommonCrypto isn't building for arch armv7 iOS
Asked Answered
M

5

9

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

Mungovan answered 22/9, 2012 at 21:7 Comment(4)
Go to your target build steps, under "link with libraries" or so, remove libcommonCrypto.dylib.Fremitus
Please note that when doing what tc said, do not move it to trash. If you do, you'll get "ld: in '/usr/lib/system/libcommonCrypto.dylib', missing required architecture armv7 in file /usr/lib/system/libcommonCrypto.dylib (2 slices) for architecture armv7". Just put it back from your trash.Ukrainian
@Fremitus why remove libCommonCrypto.dylib ?Spool
You should accept an answer to make it easier for others to find the solutionCran
A
17

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

Aeneas answered 6/11, 2013 at 9:39 Comment(1)
#import - not #includePokeberry
M
3

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.

Mutant answered 16/4, 2013 at 20:49 Comment(0)
O
0

I'm using cocoapods for library management. One of the libraries (you can simple search in your workspace) contained reference to CommonCrypto.framework which was red in the list of frameworks in its project settings.

In my case I had to remove the dependency on CommonCrypto.framework, but this solution lasts just to another update of your pods.

Btw I'd like to know a command to list the graph of dependencies among the libraries in the Podfile.

Ouzo answered 8/4, 2014 at 17:48 Comment(0)
R
0

I had the same error,

ld: in '/usr/lib/system/libcommonCrypto.dylib', missing required architecture arm64 in file /usr/lib/system/libcommonCrypto.dylib (2 slices) for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I solved this problem by checking my $PATH. It was a missing file.

Using find / -type f -name libcommonCrypto.dylib

Comparing my libs with my friends mac systems, it shows that this file was not present on my computer :

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/libcommonCrypto.dylib

Xcode using $PATH fallback on /usr/lib/system/libcommonCrypto.dylib but it's not the good built (i386 insteadof arm stuff).

I copied the version of my friend, move in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/ and then I was able to build my projects again.

There is a vicious problem here cause there is a lot same file for this lib depending of your architecture and most of them are not intended to be used for ios builds. But the $PATH env var will fallback on /usr/lib when no files are found on dedicated dirs.

Xcode fallback on /usr/lib/system/libcommonCrypto.dylib but this is definitely not the correct lib cause it not a built for ios, but a built for my mac.

Romanaromanas answered 3/10, 2014 at 13:42 Comment(0)
A
0

Better Solution ,as it says remove libcommonCrypto.dylib,and replace by adding SystemConfiguration.framework.It worked for me,might be useful to someone.I was getting Linker Error saying gettingLink against the umbrella framework 'System.framework' instead.

Atmosphere answered 17/3, 2015 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.