16

I happen to install model sim VHDL simulator on Linux. The manual says it only supports RedHat or Suse, but I just tried to install it on Ubuntu. And, I could install it without any problem.

enter image description here

  • Is linux binary universal to all kinds of distribution? I mean, if I make a program on distrubution A, can I be sure it will run on any linux?
  • Why most of the commercial program vendor says the program is running on specific distribution? (mostly Redhat and Suse, not ubuntu)

3 Answers 3

16

This is two questions:

Is a Linux binary universal to all distributions?

It depends:

  • If the program is using nothing outside the Linux kernel, it will be universal except for the 32- or 64-bit question. A Linux "hello world" (a minimalistic program that just prints "hello world" to a terminal window) could probably be independent of the distribution.
  • If the program is using any non-kernel library or service (which is most of Linux, the kernel is fairly small), there are differences in which libraries are included, which versions these libraries are and where they are located. So in this (most common) case distributions are not equal.

Why do many commercial programs say that they only work on one or a few distributions?

Because there is a very large number of Linux distributions, and nobody wants to test their program on all of them.

A commercial vendor will normally say that they support only the distributions they have tested their software on. It may or may not work on other distributions, from the vendor's perspective the point is just that you can't complain if it does not work on a distribution they don't support.

Which distributions are selected for testing depends on what the vendor expects their customers to be using. Commercial/professional programs commonly pick enterprise distributions, possibly through a reasoning similar to "people who paid for their OS are more likely to pay for our software", possibly simply by counting the distributions used by their existing customers.

See also Mark Shuttleworth (the guy that is the reason we have an Ubuntu in the first place) on binary compatibility between Ubuntu and Debian - Debian is the closest distribution relative of Ubuntu.

3

Both RedHat and SUSE have long enterprise Linux tradition and managed to get those packages produced and tested for them. As time passes, there will be more examples of packages that have been tested to work on Ubuntu. In fact, many such packages since last year come as tested to work with Ubuntu. As Canonical makes agreements with more vendors, there will be more Ubuntu-certified packages.

For your first question: If you want to make a program that runs on all distributions, create a static (compared to dynamic) executable. A statically-linked executable does not depend on the system libraries, therefore can work between distributions, as long as the architecture (such as Intel/AMD) is the same.

Here is a program,

int main(void)
{ 
  printf("Hello, World!\n");
  return 0;
}

Let's compile as normal,

$ gcc helloworld.c -o helloworld
$ ./helloworld
Hello, World!
$ ldd helloworld
    libc.so.6 => /lib/libc.so.6 (0x00007f3cc3481000)
...
$ 
$ gcc helloworld.c -static -o helloworld_static
$ ./helloworld
Hello, World!
$ ldd helloworld_static
    not a dynamic executable
$ 

So, what can you do with that VHDL program? Get the .rpm file and convert it to .deb using alien. Then, install. If it worked, you are ok. If it does not work, use ldd to figure out which library file is missing. On the worst case scenario, create a virtual machine for those other Linux distributions and run the program there.

1

I second j-g-faustus' reply, but, you also need to be careful about the package format. Even if the executables themselves are portable and all necessary libraries are present, different distros put files in different places and use different tools to manage installed packages.If the vendor packages their product as an RPM package, you will have to use a package like 'alien' to convert and install it under a DEB based distribution like Ubuntu.

If they distribute their software as source code, then you may also be able to compile it yourself, at which point the executable will be tailored for your specific system (but the ubuntu package manager won't know about it).

You must log in to answer this question.

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