ios Apple Mach-O 链接器错误 (20) - 架构 armv7 的未定义符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9931510/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 17:37:25  来源:igfitidea点击:

Apple Mach-O Linker Errors (20) - Undefined symbols for architecture armv7

iphoneiosxcodearchitecturearm7

提问by chrisjr

I received these errors after I added " -all_load " in the "Other Linker Flags" build setting once I added "libPusher-combined.a" and its header files. I followed the instructionsexactly up to the part of typing in "-all_load" (under "Using a pre-compiled static library" in the "Adding to your iOS Project", but I ended up getting 20 Mach-O Linker errors. :/ Could anyone please help me with this?

我在添加“libPusher-combined.a”及其头文件后,在“其他链接器标志”构建设置中添加“-all_load”后收到这些错误。我完全按照说明进行了输入“-all_load”的部分(在“添加到您的 iOS 项目”中的“使用预编译的静态库”下,但我最终收到了 20 个 Mach-O 链接器错误。: / 任何人都可以帮我解决这个问题吗?

Here are the errors:

以下是错误:

Undefined symbols for architecture armv7:
 "_utf8_nextCharSafeBody", referenced from:
  -[SRWebSocket _pumpScanner] in libPusher-combined.a(SRWebSocket.o)
 "_SCError", referenced from:
  -[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
 "_utf8_countTrailBytes", referenced from:
  -[SRWebSocket _pumpScanner] in libPusher-combined.a(SRWebSocket.o)
 "_SCNetworkReachabilitySetDispatchQueue", referenced from:
  -[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
  -[Reachability stopNotifier] in libPusher-combined.a(Reachability.o)
 "_kCFHTTPVersion1_1", referenced from:
  -[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageIsHeaderComplete", referenced from:
  ___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageCreateRequest", referenced from:
  -[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
 "_SCNetworkReachabilityCreateWithAddress", referenced from:
  +[Reachability reachabilityWithAddress:] in libPusher-combined.a(Reachability.o)
 "_SCErrorString", referenced from:
  -[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
 "_SCNetworkReachabilityCreateWithName", referenced from:
  +[Reachability reachabilityWithHostname:] in libPusher-combined.a(Reachability.o)
 "_CFHTTPMessageCopyAllHeaderFields", referenced from:
  ___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageGetResponseStatusCode", referenced from:
  -[SRWebSocket _HTTPHeadersDidFinish] in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageSetHeaderFieldValue", referenced from:
  -[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
  ___25-[SRWebSocket didConnect]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageCreateEmpty", referenced from:
  -[SRWebSocket _readHTTPHeader] in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageCopySerializedMessage", referenced from:
  -[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
 "_SCNetworkReachabilitySetCallback", referenced from:
  -[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
  -[Reachability stopNotifier] in libPusher-combined.a(Reachability.o)
 "_SCNetworkReachabilityGetFlags", referenced from:
  -[Reachability isReachable] in libPusher-combined.a(Reachability.o)
  -[Reachability isReachableViaWWAN] in libPusher-combined.a(Reachability.o)
  -[Reachability isReachableViaWiFi] in libPusher-combined.a(Reachability.o)
  -[Reachability connectionRequired] in libPusher-combined.a(Reachability.o)
  -[Reachability isConnectionOnDemand] in libPusher-combined.a(Reachability.o)
  -[Reachability isInterventionRequired] in libPusher-combined.a(Reachability.o)
  -[Reachability reachabilityFlags] in libPusher-combined.a(Reachability.o)
  ...
 "_CFHTTPMessageCopyHeaderFieldValue", referenced from:
  -[SRWebSocket _checkHandshake:] in libPusher-combined.a(SRWebSocket.o)
 "_CFHTTPMessageAppendBytes", referenced from:
  ___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If you need more information, just ask. I hope that I'm not giving too much trouble. Thanks in advance.

如果您需要更多信息,请直接询问。我希望我没有给太多麻烦。提前致谢。

采纳答案by Praveen-K

Can you check out in your target->Build Phase. whether these files exist there or not ? and if you are running for simulator then first you need to make a build for simulator of that library whatever i guess you are using SRWebSocket library. Just open that project and just make a build for simulator and copy the files from build folder and then add to your project and do the same for the device if you are running your app on device.

你可以在你的目标->构建阶段签出。这些文件是否存在?如果您正在运行模拟器,那么首先您需要为该库的模拟器构建一个版本,无论我猜您使用的是 SRWebSocket 库。只需打开该项目并为模拟器进行构建并从构建文件夹中复制文件,然后添加到您的项目中,如果您在设备上运行您的应用程序,则对设备执行相同的操作。

回答by Todd Hopkinson

Check to make sure you included the following frameworks (via https://github.com/square/SocketRocket) :

检查以确保您包含以下框架(通过https://github.com/square/SocketRocket):

Framework Dependencies

Your .app must be linked against the following frameworks/dylibs

libicucore.dylib CFNetwork.framework Security.framework Foundation.framework

框架依赖

您的 .app 必须链接到以下框架/dylibs

libicucore.dylib CFNetwork.framework Security.framework Foundation.framework

回答by Marius

Make sure that you also have -licucore in "Other Linker Flags", in the build settings tab, as in the attached screenshot:

确保在构建设置选项卡中的“其他链接器标志”中也有 -licucore,如所附屏幕截图所示:

Other Linker Flags

其他链接器标志

回答by movaction.com

For the latest sdk, you should add:

对于最新的 sdk,您应该添加:

libicucore.tbd 

since libicucore.dylib is not present anymore.

因为 libicucore.dylib 不再存在。

hope .tbd extension is not for "to be delete"?

希望 .tbd 扩展名不是为了“被删除”?

回答by sarabdeep singh

I copied the complete SocketRocket folder into my application for using web sockets in my application and linked libicucore.dylib, CFNetwork.framework, Security.framework, Foundation.framework binaries with my project. This removed all my errors and warnings.

我将完整的 SocketRocket 文件夹复制到我的应用程序中,以便在我的应用程序中使用 Web 套接字,并将 libicucore.dylib、CFNetwork.framework、Security.framework、Foundation.framework 二进制文件与我的项目链接起来。这消除了我所有的错误和警告。

回答by Javier

In my case when I added SystemConfiguration.framework to the project and problem went... :-)

就我而言,当我将 SystemConfiguration.framework 添加到项目时,问题就出现了...... :-)