标签: mach-o

为什么Mac OS X中的Mach-O库需要install_name_tool和otool?

我正在使用最新版本的Xcode 4开发Cocoa应用程序,我想将动态库链接到我的项目(dylibs).

我读的地方,在我的项目库添加是不够的,因为我有运行install_name_tool,并otool让我的项目中使用我的项目被捆绑的库.

我已经阅读了手册页install_name_tool,但我不明白为什么我必须这样做.

图书馆如何运作?特别感兴趣的是应用程序和库具有指向我机器中特定位置的路径的部分,例如/usr/local/lib/mylibrary.dylib运行时otool -L

macos mach-o otool install-name-tool

36
推荐指数
2
解决办法
2万
查看次数

如何使用Xcode创建动态库(dylib)?

我在Xcode中构建了一些命令行实用程序(普通C,没有Cocoa).我希望他们所有人都使用我的自定义版本的libpng,我希望通过在所有可执行文件中共享一个库副本来节省空间(我不介意重新分发.dylib它们).

我是否需要做一些魔术才能获得libpng导出符号?

"Link Binary with Libraries"是否静态构建阶段链接?

Apple的文档提到在运行时加载库dlopen,但是如何让Xcode创建可执行文件而不抱怨缺少符号?


我想我已经弄明白了:

  • libpng没有正确链接,因为我已经构建了32/64位可执行文件和32位库.库和可执行文件的构建设置必须匹配.

  • libpng的config.h需要有大量的定义 #define FEATURE_XXX_SUPPORTED

  • "Link Binary with Libraries"构建阶段处理动态库就好了,DYLD_FALLBACK_LIBRARY_PATH环境变量是.dylib从应用程序包加载s 所必需的.

xcode linker mach-o shared-libraries dylib

28
推荐指数
4
解决办法
6万
查看次数

在xCode 6中找到了一个意外的Mach-O头代码:1918975009

导致错误的原因

Found an unexpected Mach-O header code: 1918975009 in xCode 6
Run Code Online (Sandbox Code Playgroud)

我存档我的项目作为ad hoc构建发送,它建立/链接/档案很好,但当我在xCode组织者和选择时Export -> Ad Hoc,

我收到了错误

Found an unexpected Mach-O header code: 191897500. 
Run Code Online (Sandbox Code Playgroud)

xcode mach-o ios xcode6

27
推荐指数
3
解决办法
2万
查看次数

Apple Mach-O Linker错误,我不知道该怎么做

我不能再为设备或模拟器编译我的项目了.我得到13个Apple Mach-O-Linker错误.这一切都是在我尝试使用sharekit失败后开始的.这是错误的日志:

ld: warning: directory not found for option '-F/Users/bbrandy95/Documents/Broken Brandsonic Web Projects/Brandsonic Web mobile/../../Downloads/0.2.1gm1/iphoneos4.0/System/Library/Frameworks'
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_NSURLRequest", referenced from:
      objc-class-ref in Brandsonic_Web_mobileAppDelegate.o
      objc-class-ref in Brandsonic_Web_mobileViewController.o
  "_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
      objc-class-ref in main.o
  "_objc_msgSendSuper2", referenced from:
      -[Brandsonic_Web_mobileAppDelegate dealloc] in Brandsonic_Web_mobileAppDelegate.o
      -[Brandsonic_Web_mobileViewController didReceiveMemoryWarning] in Brandsonic_Web_mobileViewController.o
      -[Brandsonic_Web_mobileViewController dealloc] in Brandsonic_Web_mobileViewController.o
  "_objc_setProperty", referenced from:
      -[Brandsonic_Web_mobileAppDelegate setWindow:] in Brandsonic_Web_mobileAppDelegate.o
      -[Brandsonic_Web_mobileAppDelegate setViewController:] in Brandsonic_Web_mobileAppDelegate.o
  "__objc_empty_vtable", referenced from:
      _OBJC_CLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
      _OBJC_METACLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
      _OBJC_CLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
      _OBJC_METACLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
      _OBJC_METACLASS_$_SecondView in SecondView.o
      _OBJC_CLASS_$_SecondView …
Run Code Online (Sandbox Code Playgroud)

xcode mach-o ios xcode4 ios5

26
推荐指数
4
解决办法
7万
查看次数

Apple Mach-O链接器(id)警告:为MacOSX构建,但是针对为iOS构建的dylib进行链接

从过去xCode 4中的某个点开始抱怨链接器问题:

ld:warning:为MacOSX构建,但是针对为iOS构建的dylib链接:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics

我已经检查了所有内容,但在配置中仍然没有任何可疑,它编译并运行.我看到它唯一的东西是CoreGraphics.framework之前的双斜线,为什么我不知道.尝试删除并在"构建阶段"上再次添加库,但没有帮助.

xcode linker mach-o dylib ios

25
推荐指数
3
解决办法
9379
查看次数

链接器命令错误:找不到架构i386的'ld:符号'

我在编译时遇到错误.似乎很奇怪.它作为详细视图应用程序工作,但使用单一视图似乎不起作用.这是错误细节:

   Undefined symbols for architecture i386:
    "_OBJC_CLASS_$_RssArticle", referenced from:
      objc-class-ref in RssXmlParser.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

xcode compiler-errors mach-o ios

25
推荐指数
4
解决办法
10万
查看次数

Apple Mach-O链接器警告不会消失

我已经在我的项目中发布了这个Apple Mach-O链接器警告几天了.它比任何东西都更烦人,但我担心它可能会以某种方式影响我的应用程序的性能(我在Xcode上遇到了很多奇怪的问题,我现在不会怀疑任何事情).警告说:

警告:找不到选项'-L/Volumes/ZBarSDK/ZBarSDK'的目录

我不知道是什么导致这个或如何解决它.我的应用程序中有一个名为ZBarSDK的文件夹,但添加另一个ZBarSDK无法解决问题!我试着在我的电脑上搜索一个没有运气的Volumes文件夹,要么它不在那里,要么Apple把它藏得很好.请让我知道我可以做些什么来解决这个问题

xcode warnings mach-o

25
推荐指数
3
解决办法
2万
查看次数

APPLE MACH-O LINKED ERROR添加AFNetworking后

只是将AFNetworking添加到我的项目中,在B&R之后我得到了这样的错误:

Undefined symbols for architecture i386:
"_SecCertificateCopyData", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in       AFURLConnectionOperation.o
"_SecCertificateCreateWithData", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in  AFURLConnectionOperation.o
"_SecPolicyCreateBasicX509", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustCopyPublicKey", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustCreateWithCertificates", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustEvaluate", referenced from:
  ___44+[AFURLConnectionOperation pinnedPublicKeys]_block_invoke in AFURLConnectionOperation.o
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustGetCertificateAtIndex", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
"_SecTrustGetCertificateCount", referenced from:
  -[AFURLConnectionOperation connection:willSendRequestForAuthenticationChallenge:] in AFURLConnectionOperation.o
ld: symbol(s) …
Run Code Online (Sandbox Code Playgroud)

mach-o linker-errors ios afnetworking

24
推荐指数
2
解决办法
7652
查看次数

在iPhone上使用语言

可以用Go for iPhone写吗?我认为需要采取以下步骤

  1. 编译Go作为ARM Mach-O二进制文件(我希望GCCGO能够做到这一点)

  2. 将iPhone应用程序编译为静态库(我认为可以重命名main() - > main2()等)

  3. 将Go编译为与iPhone静态库链接的Mach-O二进制文件.Go必须调用main2.

  4. 制作一些plist文件,zip,sign

mach-o go ios gccgo

23
推荐指数
3
解决办法
2万
查看次数

Xcode给Apple Mach-O链接器错误

我刚编译了一个项目,Xcode返回这两个错误,这些错误似乎不是我代码的错.我该如何解决?

Undefined symbols for architecture i386:
  "_vImageBoxConvolve_ARGB8888", referenced from:
      -[UIImage(Blur) boxblurImageWithBlur:] in UIImage+Blur.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

mach-o objective-c linker-errors undefined-symbol ios

23
推荐指数
2
解决办法
5万
查看次数