xcode CommonCrypto 不是为 arch armv7 iOS 构建的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12547711/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CommonCrypto isn't building for arch armv7 iOS
提问by iosfreak
I recently just upgraded to the new XCode. After I upgraded, some of my apps won't build. I get this error:
我最近刚刚升级到新的 XCode。升级后,我的一些应用程序无法构建。我收到此错误:
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
请帮忙
回答by Heider Sati
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.
问题是,当我将在主界面的库(主构建的设置...等),我最初寻找crypto
,然后有两只库回来libcorecrypto.dylib
并且liblibcommonCrypto.dylib
,如果你注意到,无论是在不像一般为灰色,颜色存在您通常添加的黄色库。添加这些会导致编译器返回报告(缺少一些其他库,例如 libz,或者您承担的功能越多将需要的另一个库。
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
如果您注意到上述两个库通常位于JavaScriptCore.framework
库(黄色的)下,因此,通过删除上述两个并添加JavaScriptCore.framework
,问题已解决,并build successful
显示
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.
还要提到的是,基于作为内部包存在的灰色库JavaScriptCore.framework
,libcrypto 和另一个将不存在于/Library/.../system/path
上面提到的下,即您没有从系统中删除它们,它们只是不存在。
Again, the solution is:
再次,解决方案是:
*From your main XCODE project settings, don't add:*dd
*从您的主要 XCODE 项目设置中,不要添加:*dd
libcorecrypto.dylib
liblibcommonCrypto.dylib
Instead, add:
相反,添加:
JavaScriptCore.framework
In your .m (code), just source them normally by doing:
在您的 .m(代码)中,只需通过以下方式正常获取它们:
#include <CommonCrypto/CommonDigest.h> (or any of your other libs as needed in code)...
It should work fine.
它应该可以正常工作。
I hope this helps.
我希望这有帮助。
Kind Regards
亲切的问候
回答by eGanges
I just solved this as follows:
我刚刚解决了这个问题:
It turns out that the libcommonCrypto.dylib error was a red herring.
事实证明,libcommonCrypto.dylib 错误是一个红鲱鱼。
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).
按照上面的建议删除 libcommonCrypto.dylib 后,我收到了 9 个新错误。乍一看,我以为它们是加密错误,但实际上并非如此;对我来说,它实际上可以追溯到没有被包含在内的 zLib,它是在整体实现的更深层部分(其中加密是其中的一部分)中“导入”的。
For me specifically, it traced back to ASIDataDecompressor.h, #import < zlib.h>
对我来说,它可以追溯到 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.
我通过包含缺少的 libz.dylib 框架来修复它;最终,我不必明确包含 libcommonCrypto.dylib。
So, be sure to check the errors closely after toggling libcommonCrypto, and make sure some OTHER libraries are not missing, instead.
因此,请务必在切换 libcommonCrypto 后仔细检查错误,并确保没有丢失某些其他库。
回答by Vladimír Slavík
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.
我正在使用 cocoapods 进行图书馆管理。其中一个库(您可以在您的工作区中进行简单搜索)包含对 CommonCrypto.framework 的引用,它在其项目设置的框架列表中是红色的。
In my case I had to remove the dependency on CommonCrypto.framework, but this solution lasts just to another update of your pods.
在我的情况下,我不得不删除对 CommonCrypto.framework 的依赖,但这个解决方案只持续到你的 pod 的另一个更新。
Btw I'd like to know a command to list the graph of dependencies among the libraries in the Podfile.
顺便说一句,我想知道一个命令来列出 Podfile 中库之间的依赖关系图。
回答by evaisse
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)
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.
我通过检查 $PATH 解决了这个问题。这是一个丢失的文件。
Using find / -type f -name libcommonCrypto.dylib
使用 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 :
将我的库与我朋友的 mac 系统进行比较,它表明我的计算机上不存在此文件:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/libcommonCrypto.dylib
/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).
Xcode 使用 $PATH 回退,/usr/lib/system/libcommonCrypto.dylib
但它不是很好的构建(i386 而不是 arm 的东西)。
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.
我复制了我朋友的版本,搬进来/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/
,然后我能够再次构建我的项目。
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.
这里有一个严重的问题,因为根据您的架构,这个库有很多相同的文件,而且其中大部分不打算用于 ios 构建。但是当在专用目录上找不到文件时, $PATH env var 将回退到 /usr/lib 。
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.
Xcode 后备,/usr/lib/system/libcommonCrypto.dylib
但这绝对不是正确的库,因为它不是为 ios 构建的,而是为我的 mac 构建的。
回答by Rajal
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.
更好的解决方案,因为它说删除 libcommonCrypto.dylib,并通过添加 SystemConfiguration.framework 替换。它对我有用,可能对某人有用。我收到链接器错误,说针对伞形框架“System.framework”获取链接。