简体   繁体   English

如何合并为armv7和i386构建的两个.a文件?

[英]How to merge two .a files which is built for armv7 and i386?

I have 2 static library(.a) files. 我有2个静态库(.a)文件。 These 2 files are basically same library. 这两个文件基本上是相同的库。 one is built for architecture armv7, another one is built for architecture i386. 一个用于架构armv7,另一个用于架构i386。 Is it possible to merge these 2 libraries into 1 file? 是否可以将这两个库合并为一个文件? Unfortunately, I don't have any source code to re-build them. 不幸的是,我没有任何源代码来重新构建它们。

Thank you in advance :D 提前谢谢你:D

You need to get to know what can be done with the lipo and libtool command line tools, both of which come with Xcode. 你需要了解使用lipolibtool命令行工具可以做些什么,这两个工具都带有Xcode。

Here's a tutorial that might get you started on the process. 这是一个可以帮助您开始此过程的教程

The steps include something like: 步骤包括:

  1. lipo -info libFirst.a libSecond.a find out what architectures are in the .a files lipo -info libFirst.a libSecond.a找出.a文件中的架构
  2. lipo -extract armv7s libFirst.a -o libFirst_armv7s.a extract the architectures you want lipo -extract armv7s libFirst.a -o libFirst_armv7s.a提取你想要的架构
  3. libtool -static libFirst_armv7.a libSecond_armv7.a -o libCombined_armv7.a combine the architecture specific .a files into one libtool -static libFirst_armv7.a libSecond_armv7.a -o libCombined_armv7.a将特定于体系结构的.a文件合并为一个
  4. lipo -create libCombined_armv7.a libCombined_armv7s.a -o libCombined.a and this gives you the final .a library. lipo -create libCombined_armv7.a libCombined_armv7s.a -o libCombined.a ,这将为您提供最终的.a库。

And here's some older documentation from Apple which describes how to use the tools to create combined static libraries. 这里是Apple一些旧文档 ,描述了如何使用这些工具创建组合静态库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM