Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In general, will binaries built on FreeBSD run on Linux operating systems, especially Ubuntu?

share|improve this question
up vote 5 down vote accepted

You cannot run binaries built for FreeBSD on Linux (see this question). They basically are different operating systems, sharing only a small subset of APIs (POSIX compatibility).

However, if you have the source code, you can build binaries for Linux on FreeBSD; the term is "cross-compiling". For example, programs for Windows are often compiled on a Linux system.

share|improve this answer

In theory, you could have an operating system run binaries made for other operating systems. In practice it takes work, and it doesn't happen a lot because people don't want to do the work for it.

There are a few things that can get in the way:

  • Different Chips
  • Different system calls
  • Different library calls
  • Files/paths are different.

So, lets say you want to run an Intel FreeBSD binary on an Intel Linux machine. The chip would be the same, no emulation needed. But the syscall interface is different. Someone would have to write code for the Linux kernel to realize that when you run a FreeBSD binary, to use a different syscall table. This made a bit easier since they're both UNIX, a lot of the code can be the same.

But then you'd need the libraries. These could be in theory copied from a FreeBSD distribution, and the dynamic loader would then know this special place for FreeBSD libraries. If there were any config file paths, or hard coded output paths, this would have to be dealt with as well.

So, its doable, but it takes work. A lot of work. As such, the work is done usually only for a unpopular (or too new) OS to run binaries for a more popular or established OS.

Initially, Microsoft NT was able to run OS/2 command line apps, and had some theoretical (half-assed) ability to run POSIX apps. This ability has been dropped as OS/2 became irrelevant, and people liked NT for NT, not as anything that could run POSIX. I'm not qualified enough to say whether Windows 7 running Windows 95 apps is considered running from another OS, or just runs some ancient code melded into Win7.

Mac OSX could run MacOS 7/8 binaries if they were coded for something called Carbon (a set of compatibility libraries). This helped in the migration to MacOSX. They needed emulation for the PowerPC chip as well.

Since Linux is more common than FreeBSD, there really isn't a need for a lot of people to emulate FreeBSD on Linux. It would be rare for an app on FreeBSD to not be available on Linux. So no one has done that work. But, there is capability for FreeBSD to run Linux binaries. Since Linux is a moving target, the emulation needs to be updated when the Linux kernel changes a lot, or it needs new libraries.

share|improve this answer
Thank you for this detailed answer. – Brian May 26 '11 at 17:06
Programs made for Windows 95 run on the same Win32 subsystem (although some of them have compatibility shims automatically applied). Also, apparently Windows NT with SfU is more POSIX-compliant than Linux; however, it only provides POSIX APIs, not binary compatibility (with Linux ELF or whatever). – grawity May 26 '11 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .