在Mac OS X模拟Linux程序 [英] Emulating Linux binaries under Mac OS X

查看:349
本文介绍了在Mac OS X模拟Linux程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Mac OS X上运行Linux程序?

How do I run Linux binaries under Mac OS X?

周围的Googling我发现一对夫妇仿真器,但没有在Mac上运行Linux二进制文件。有大约在Linux上运行的Mac OS X不少帖子和诸如此类的东西 - 但这是什么,我想要做的相反

Googling around I found a couple of emulators but none for running Linux binaries on a Mac. There are quite a few posts about running Mac OS X on Linux and that kind of stuff - but that's the opposite of what I want to do.

更新:

感谢所有的答案!本人完全清楚的MacPorts和芬克或任何其他东西;没有,我不希望任何这些工具,我不希望任何的包管理器,我preFER编译东西我自己。我也有和的Parallels可以建立虚拟机和所有的爵士乐......

Thanks for all the answers! I am fully aware of MacPorts and Fink or any of the other things; and no, I do not want any of these utilities, and I do not want any of the package managers, I prefer to compile things myself. I also have Parallels and could set up virtual machines and all that jazz...

我想要做的唯一一件事就是找到一种方式来运行,我没有源$ C ​​$ C并已编译的Linux二进制,但我并不想在Linux下,但下运行Mac OS X的因此我对模拟器的问题。

The only thing I want to do is to find a way to run a binary that I do not have the source code for and has been compiled for Linux, but I do not want to run it under Linux but under Mac OS X. Therefore my question about emulators.

推荐答案

那么有一个项目,引进类似的Linux的binfmt_misc到OS X所以现在你需要的是一个ELF装载器,动态连接器,可以同时加载的Mach-O和ELF,以及一些机制来翻译的Linux调用OS X的。

Well there is a project introducing something like Linux's binfmt_misc to OS X so now what you need is an ELF loader, a dynamic linker that can load both Mach-O and ELF, and some mechanism to translate Linux calls to OS X ones.

就为灵感,可以实现的,因为它忽略文件扩展名的时尚动态链接器 - 无论是在libfoo.so.1(作为Linux的ELF)和libfoo.1.dylib(作为Mach-O的)可以加载所以系统库的OS X版本,可以重复使用,这样你就不需要写了托管在OS Xlibc.so和系统调用可以通过转换的Linux调用内核OS X的人的KEXT处理。

Just for inspiration, you can implement the dynamic linker in the fashion that it ignores filename extension - both libfoo.so.1 (as an Linux ELF) and libfoo.1.dylib (as an Mach-O) can be loaded so that OS X versions of system libraries can be reused so that you do not need to write a "hosted on OS X" libc.so and syscalls can be handled by an kext that translates Linux calls to OS X ones in kernel.

或者,在一个更​​优雅的方式,实现一个精简的Linux内核作为一个KEXT,使OS X内核两用。然而,这将要求您使用两套库。 (二进制文件不冲突,因此在很大程度上是好的)

Or, in an more elegant way, implement a stripped down Linux kernel as a kext that makes the OS X kernel a dual-purpose. However that will require you to use two sets of libraries. (Binaries do not clash so it is largely okay)

这篇关于在Mac OS X模拟Linux程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆