我可以建立在Mac OS库的32位和64位架构? [英] Can I build both 32-bit and 64-bit architectures of a library on Mac OS?
问题描述
我需要在Mac OS X上建立一个库(Ipopt),并从两个不同的程序(Python的&安培; Matlab的)使用它。然而,一个程序是32位,而另一个是64位。我一定要建立两种架构的两个独立的库,然后相应地设置路径每个程序?或者,我可以建立在同一个库文件(S)两种架构,程序会选择正确的架构加载?如果可以,那么如何?
I need to build a library (Ipopt) on Mac OS X and use it from two different programs (Python & Matlab). However, one program is 32-bit and the other is 64-bit. Do I have to build two separate libraries of the two architectures then set the path accordingly for each program? Or can I build both architectures in the same library file(s) and the program will select the correct architecture to load? If I can, then how?
谢谢!
推荐答案
您可以建立两种架构,并结合成一个单一的二进制文件。要做到这一点的工具是脂
。
You can build both architectures and combine them into a single binary. The tool to do this is lipo
.
例如,如果你已经建立libpopt作为一个32位的库,并把它放在的lib /
,再次建造它作为一个64位的库,并放置在 lib64的/
,然后命令结合这两种可能是:
For example, if you had built libpopt as a 32 bit library and placed it in lib/
, and built it again as a 64 bit library and placed that in lib64/
, then the command to combine these two could be:
lipo lib/libpopt.a lib64/libpopt.a -create -output libUniversal/libpopt.a
有关详细信息,请参阅脂手册页(<一个href=\"http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/lipo.1.html\"相对=nofollow>这里,或通过男人脂
)。
For more information, see the lipo man page (here, or through man lipo
).
这篇关于我可以建立在Mac OS库的32位和64位架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!