在Xcode项目目标构建设置中,什么是Mach-O类型? [英] In Xcode project target build settings, What is Mach-O Type?

查看:154
本文介绍了在Xcode项目目标构建设置中,什么是Mach-O类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在厌倦了众多Match-O链接器错误后,我想知道这件事意味着什么。我想知道这些事情背后的概念,而不是试错法。具体来说,我想知道以下区别:

After getting tired of numerous Match-O linker error, I want to know that this thing means. Instead of trial and error solution, I would like to know the concept behind these things. Specifically I want to know the difference between :


  1. 可执行文件

  2. 动态库

  3. Bundle

  4. 静态库

  5. 可重定位目标文件

  1. Executable
  2. Dynamic Library
  3. Bundle
  4. Static Library
  5. Relocatable Object File

这些是我点击链接部分上的Mach-O类型设置时显示的选项。一些小的定义或一些链接到适当的内容也是可以的。

These are the options presented when I click on Mach-O Type settings on Linking section. Some small definition or some link to appropriate content is ok too.

推荐答案

a.out 但有改进。这是Mac OS X和iPhone OS库中用于可执行文件的格式。

Mach-O, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. For unix users this is like a.out but with improvements. This is the format used in Mac OS X and iPhone OS libraries for executable files.

如您所知,iOS设备(iPhone,iPad等)具有不同的体系结构ARMv6(iPhone 2G + 3G,iPod Touch)和ARMv7(iPhone 3GS,iPod Touch 2G + 3G),但Xcode中使用的模拟器主要在i386平台上运行。这意味着库客户端必须为模拟器和设备设置单独的目标。单独的目标复制大多数信息,并且仅在包含的静态库中有所不同。因此,如果您遇到Mach-O链接器错误,则意味着xcode无法链接到该目标设备的其中一个库;因此编译失败。

As you know iOS devices (iPhone, iPad etc.) have different architectures ARMv6 (iPhone 2G + 3G, iPod Touch) and ARMv7 (iPhone 3GS, iPod Touch 2G + 3G) but the simulators used in Xcode runs mostly on i386 platform. This means the that the library clients have to setup separate targets for the simulator and device. The separate targets duplicate most information, and only differ in the static libraries included. So if you are getting a Mach-O linker error what it means is that xcode is having trouble linking to one of the libraries for that target device; as a result of which compilation fails.

现在你的定义 -


  1. 可执行文件 - 编译的机器目标程序准备以二进制格式运行。

  2. 动态库 - 在运行时链接 - 带有动态库引用的程序将在启动时(或按需)加载并链接库。

  3. 捆绑包 - 以及捆绑包标识符让iOS和OSX识别您应用的任何更新。它在应用程序中提供了独特的存在。

  4. 静态库 - 文件在构建时链接。代码被复制到可执行文件中。将删除程序中未引用的库中的代码。只有静态库的程序在运行时没有任何依赖关系。

  5. 可重定位目标文件 - 是动态库的另一个词。当您链接到动态库时,将根据库在内存中的加载位置计算其中包含的函数的地址。它们是可重定位的,因为包含的函数的地址不是在链接时确定的。 (在静态库中,地址是在链接时计算的。)

  1. Executable - compiled machine targeted program ready to be run in binary format.
  2. Dynamic Library - are linked during runtime -- a program with references to a dynamic library will load and link with the library when it starts up (or on demand).
  3. Bundles - and bundle identifier let iOS and OSX recognise any updates to your app. It gives it a unique presence in the app.
  4. Static Library - files are linked at build time. code is copied into the executable. Code in the library that isn't referenced by your program is removed. A program with only static libraries doesn't have any dependencies during runtime.
  5. Relocatable Object File - is another word for a dynamic library. When you link with a dynamic library, the addresses of the functions contained within are computed, based on where the library is loaded in memory. They are "relocatable" because the addresses of the contained functions are not determined at link time. (In a static library, the addresses are computed during link time.)

这篇关于在Xcode项目目标构建设置中,什么是Mach-O类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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