如何构建 fat gcc46 libstdc++在 OS X 上?
我已经在我的 OS X 机器上成功构建并安装了 gcc 4.6.1,但我似乎无法让它为我创建一个胖/通用 libstdc++ 库。我怎样才能让它做到这一点?
默认的 /usr/lib/libstdc++.6.dylib 支持以下体系结构:
[host:~] nsteiner% file /usr/lib/libstdc++.6.dylib
/usr/lib/libstdc++.6.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libstdc++.6.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/lib/libstdc++.6.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
/usr/lib/libstdc++.6.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
我希望 gcc 为这些相同的体系结构提供 /usr/local/lib/libstdc++.6.dylib ,但我尝试 使用
或--enable-multilib
或 --with-multilib-list=i386,ppc,x86_64
配置--enable-targets=all
显然被误导了。 configure
和 make
都不会生成错误,但生成的只是:
[host:~] nsteiner% file /usr/local/lib/libstdc++.6.dylib
/usr/local/lib/libstdc++.6.dylib: Mach-O 64-bit dynamically linked shared library x86_64
I have successfully built and installed gcc 4.6.1 on my OS X box, but I can't seem to get it to create a fat/universal libstdc++ library for me. How do I make it do that?
The default /usr/lib/libstdc++.6.dylib supports the following architectures:
[host:~] nsteiner% file /usr/lib/libstdc++.6.dylib
/usr/lib/libstdc++.6.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libstdc++.6.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/lib/libstdc++.6.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
/usr/lib/libstdc++.6.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
I would like for gcc to give me a /usr/local/lib/libstdc++.6.dylib for those same architectures, but my attempts to configure
with --enable-multilib
or --with-multilib-list=i386,ppc,x86_64
or --enable-targets=all
were clearly misguided. Neither configure
nor make
generate errors, but all that gets generated is this:
[host:~] nsteiner% file /usr/local/lib/libstdc++.6.dylib
/usr/local/lib/libstdc++.6.dylib: Mach-O 64-bit dynamically linked shared library x86_64
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只有 Apple 的 GCC 4.2.1 仍然支持 fat 二进制文件。您必须采取额外的手动步骤(或提供非常好的包装脚本)来将所有源代码编译两次,并在生成的二进制文件上运行 lipo。
Only Apple's GCC 4.2.1 still supports fat binaries. You'll have to take additional manual steps (or provide damn good wrapper scripts) to compile all sources twice, and run lipo on the resulting binaries.