Mac OS X上的Linux交叉编译器? [英] Cross-compiler for Linux on Mac OS X?
问题描述
我已经在Internet上阅读了大量有关在Mac OS X上为Linux创建交叉编译器的文档,但是无法进行任何工作.
I've been reading lots of documents on the internet about creating a cross compiler for linux on mac os x but can't seam to get any to work.
It seams as if no one can help me with the question: Getting GMP to work with GCC 4.5.2
有没有更简单的方法来创建交叉编译器?
Is there any easy'er way to create a cross compiler?
推荐答案
为了针对与您的构建主机不同的体系结构构建二进制文件,您不仅需要交叉编译器,而且还需要功能全面的工具链,正如您可能发现的那样,创建起来可能是一个真正的痛苦.
In order to build binaries for architectures different that your build host, you need far more than just a cross-compiler - you need a full-blown toolchain, which can be a real pain to create, as you probably discovered.
几种方法:
-
在虚拟机(例如VirtualBox)中使用适当的Linux发行版.如果您只想在MacOSX/x86_64主机上为Linux/i386构建二进制文件,我认为这是最简单,最安全和最干净的解决方案.当然,它不是交叉编译器,但它可以工作,并且具有可以实际测试可执行文件的附加优点.
Use a proper Linux distribution in a virtual machine, such as VirtualBox. If you only want to build binaries for Linux/i386 on an MacOSX/x86_64 host, this is - in my opinion - the easiest, safest and most clean solution. It is not a cross-compiler, of course, but it works and it has the added advantage that you can actually test your executables.
使用脚本 crosstool-NG
(原始的 crosstool
)可自动构建工具链-绝对比自己构建工具链更容易,尽管您可能会必须为稍旧的编译器版本做出妥协.
Use a script such crosstool-NG
(a descendant of the original crosstool
) to automatically build the toolchain - definitely easier than building it on your own, although you may have to compromise for slightly older compiler versions.
这篇关于Mac OS X上的Linux交叉编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!