应用程序在iOS 6上崩溃:未找到符号:___sync_fetch_and_add_4 [英] App crashes on iOS 6: Symbol not found: ___sync_fetch_and_add_4

查看:157
本文介绍了应用程序在iOS 6上崩溃:未找到符号:___sync_fetch_and_add_4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以与iOS4和iOS5完美配合的应用程序。它使用针对ARM的zeromq库的静态编译版本。苹果否认我的应用程序,因为他们声称它在iOS 6下崩溃(还没有发布..wth?)



在iOS 6 GM上试用它之后,我们初始化ZeroMQ套接字。这是崩溃消息:

pre $ lt; code> dyld:懒符号绑定失败:找不到符号:___sync_fetch_and_add_4
引用自:/ var / mobile / Applications / 00EDEEDA-0068-4061-9188-01D627F9A6D6 / OpenAir.app / OpenAir
预计位置:/usr/lib/libSystem.B.dylib

dyld:符号不是找到:___sync_fetch_and_add_4
参考文献:/var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
预计位置:/usr/lib/libSystem.B.dylib

我明白__sync_fetch_add_4符号是一个编译器原子内建的。我知道ZeroMQ使用互斥锁来实现内部锁定。我一直在到处搜索,试图找出iOS6中可能导致这些符号不存在的变化。



使用Xcode 4.5和iOS6 GM,库不会甚至可以使用相同类型的消息进行编译:

 架构armv7的未定义符号:
___sync_fetch_and_add_4在libzmq.a中的
zmq :: socket_base_t :: unregister_session(std :: basic_string< unsigned char,std :: char_traits< unsigned char> ;, std :: allocator< unsigned char>>)(libzmq_la-socket_base .o)

有没有办法在苹果编译器中禁用原子内建函数来试图绕过这个问题完全是这样吗?

解决方案

应该没必要降级到早期版本的iOS。我认为关键是要使用可用于C和Objective C开发的额外绑定: rel =nofollow> http://czmq.zeromq.org/
http://www.zeromq.org/bindings:objc



我使用了czmq,并且可以在iOS 6项目中使用xcode确认这些构建。我花了一些时间试图让这些工作,因为没有太多关于在iOS SDK中使用它们的文档,但发现最简单的方法是:



库应该成功链接在一起,那么您应该很好!

I have an application that works perfectly with iOS4 and iOS5. It uses a statically compiled version of the zeromq library, targeted for ARM. Apple denied my application because they claim it crashes under iOS 6 (yet unreleased..wth?)

After trying it with the iOS 6 GM I can confirm it does crash when we initialize the ZeroMQ socket. Here is the crash messages:

dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib

I understand the __sync_fetch_add_4 symbol is a compiler atomic builtin. I know that ZeroMQ is using mutexes for it's internal locking. I have been searching everywhere to try to figure out what changed in iOS6 that could cause these symbols not to be present.

Using Xcode 4.5 and iOS6 GM, the library will not even compile with the same type of message:

Undefined symbols for architecture armv7:
  "___sync_fetch_and_add_4", referenced from:
      zmq::socket_base_t::unregister_session(std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> > const&)in libzmq.a(libzmq_la-socket_base.o)

Is there a way to disable atomic builtins in the Apple compilers to try to bypass this problem altogether?

解决方案

It shouldn't really be necessary to downgrade to an early version of iOS. I think the key is to use the extra bindings that are available for C and objective C development:

http://czmq.zeromq.org/ http://www.zeromq.org/bindings:objc

I used the czmq ones and can confirm these build with xcode in an iOS 6 project. I spent some time trying to get these to work as there's not much documentation on using them with iOS SDKs, but found the easiest method was to:

  • Download zeromq from http://download.zeromq.org/zeromq-3.2.2.tar.gz, extract, configure and build from the command line.
  • Download czmq from the link above and extract.
  • Import the src and include paths from the above into an xcode project.
  • Add -lstdc++ to the 'Other Linker Flags' section under 'Build Settings' for your target project
  • Import "czmq.h"

The libraries should successfully link together, then you should be good to go!

这篇关于应用程序在iOS 6上崩溃:未找到符号:___sync_fetch_and_add_4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆