如何为不同的架构构建mach-0?

发布于 2024-09-04 13:26:26 字数 799 浏览 1 评论 0原文

我有一些 dylibs 可以用 ctypes 从 python 加载。我可以毫无问题地加载libbass.dylib,但无法加载自编译的libmp3lame.dylib。这是我得到的错误。

操作系统错误:dlopen(libmp3lame.dylib,6): 没有找到合适的图片。是否发现: libmp3lame.dylib:mach-o,但错误 架构

,我检查这些库的文件类型。这是 libbass.dylib 的结果:

libbass.dylib: Mach-O universal binary with 2 architectures
libbass.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libbass.dylib (for architecture ppc): Mach-O dynamically linked shared library ppc

这是自编译的:

libmp3lame.dylib: Mach-O 64-bit dynamically linked shared library x86_64

我确实使用安装说明编译了 lame 库:

./configure
make
make install

我是 mac 系统的新手,问题来了:如何构建 libmp3lame.dylib 所以它支持我想要的不同架构?

谢谢。

I have some dylibs to load from python with ctypes. I can load libbass.dylib without problem, but I can't load the self-compiled libmp3lame.dylib. Here is the error I get.

OSError: dlopen(libmp3lame.dylib, 6):
no suitable image found. Did find:
libmp3lame.dylib: mach-o, but wrong
architecture

Then, I inspect the file type of those libs. Here is the result of libbass.dylib:

libbass.dylib: Mach-O universal binary with 2 architectures
libbass.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libbass.dylib (for architecture ppc): Mach-O dynamically linked shared library ppc

And here is the self-compiled one:

libmp3lame.dylib: Mach-O 64-bit dynamically linked shared library x86_64

I did compile the lame library with the install instructions:

./configure
make
make install

I'm new to mac system, here comes the problem: how to build the libmp3lame.dylib so that it supports different architecture I want?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

站稳脚跟 2024-09-11 13:26:26

只需运行:

CFLAGS="-arch i386 -arch x86_64 -arch pcc" ./configure

有关详细信息,请参阅 http://developer.apple。 com/library/mac/#technotes/tn2005/tn2137.html

Just run:

CFLAGS="-arch i386 -arch x86_64 -arch pcc" ./configure

For further information, see http://developer.apple.com/library/mac/#technotes/tn2005/tn2137.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文