42

What allows BSD to run Linux (and other Unix-like) binaries, but Linux (and other Unix-like for the most part) cannot run BSD binaries?

  • Don't know but the answer might have something to do with their licenses. I would imagine BSD not being compatible with GPL, that and most Linux devs simply don't bring up the BSD argument its a hush word. – user119867 Jun 17 '15 at 21:25
55

Market forces.

There are many more programs targeted specifically at Linux than at *BSD. A lot of software source code is portable enough that it can be compiled on both, but many software producers that ship Linux binaries do not bother to do so for the BSDs since they have smaller market shares than Linux, across the board.¹

If a piece of software is only available in binary form for a different OS, ABI emulation is one way to make it run, which is what the BSDs do.²

Once upon a time, when x86 Unix held a market majority over Linux, the iBCS feature was added to Linux to allow it to run binaries built for SCO Unix and such. Interest in this feature declined as Linux's market share increased, so that it was allowed to fall into disrepair during the Linux 2.3 development series.³ The SCO lawsuits helped usher this feature out of Linux, but I believe that's secondary to the loss of the market force that birthed the feature.

There's no technical reason why Linux couldn't some day get an iBCS-like feature for running BSD binaries, but it's not likely unless the market positions of BSD and Linux switch for some reason.

Today, there is little call for such a thing. How many binary-only programs for BSD are you aware of, which aren't also built for Linux? There must be some, but I'd guess most of them are for embedded BSDs, such as Junos. Such a feature won't be created if it doesn't allow an important set of programs to run on Linux that wouldn't otherwise run.⁴


Footnotes:

  1. I'm not counting OS X as a BSD here, since that's a separate binary compatibility problem. FreeBSD, OpenBSD and NetBSD use ELF on x86, whereas OS X uses an entirely different executable format. Dynamic linkage is also vastly different on OS X than on the traditional x86 BSDs.

    See this question for more on the Linux ⇔ OS X binary compatibility story.

  2. FreeBSD; OpenBSD; NetBSD

  3. As with certain species of shark, software that stops moving forward dies. We call this phenomenon bit-rot rather than asphyxiation when it happens to software, but the cause and effect are the same.

  4. Contrast NDISwrapper, which allows Linux to run binary-only network card drivers written for Windows XP. A need is identified, and a need is filled. Where is this need to run BSD-only binaries?

  • 3
    Linux does have the infrastructure to execute non-native binaries via the binfmt_misc module, which allows you to register arbitrary binary format handlers. Some people run Mono applications this way, though I think it's rare. But as you say, no one has had much reason to write a *BSD binfmt handler. – KutuluMike Dec 8 '14 at 12:15
  • This was really helpful. I was just looking through FreeBSD manuals (before asking question), and it was saying BSD can handle cross-*nix binaries, and Linux couldn't, but it didn't explain it. That makes sense, although honestly I was expecting more of a technical reason, rather than market forces being the cause, but honestly it appears they [technical reasons and popularity] are much closer connected than I though. – No Time Dec 8 '14 at 19:31
  • 3
    Note that it's not just about BSD. You see this exact same trend across all Unices: back in the day, Linux could run pretty much any Unix binary: iBCS supported Solaris, 386BSD, FreeBSD, NetBSD, BSDI/386, SVR4 (Interactive, Unixware, USL, Dell etc.), SVR3 generic, SCO, SCO OpenServer 5, Wyse V/386, Xenix V/386, Xenix 286 and probably some others. Nowadays, it's the other way round: all modern Unices support running Linux binaries. There are two examples were this feature was deemed so important that the vendor even put it in the name! (IBM AIX 5L for "Linux", HP-UX 11i for "integration".) – Jörg W Mittag Dec 9 '14 at 0:43
  • 1
    @JörgWMittag Neither AIX 5L nor HP-UX 11i actually run Linux binaries, not to mention they do not support the x86 architecture in the first place. What they might provide is a GNU development environment that ease building AIX, resp HP-UX binaries from source code. – jlliagre Jun 17 '15 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.