Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm planning on writing an app that I would like to be able to run on any Linux installation without having to rewrite any of the code in doing so (except maybe the interface, GNOME vs KDE, etc).

I'm not very experienced in the minutiae of the differences between distros, and I also can't provide details about the project as it's only just entered the planning stage other than it's going to be poking around deep inside the kernel in order to interact with as much of the computer's hardware as possible.

share|improve this question
    
open source or proprietary? compiled or interpreted? –  xenoterracide Dec 16 '10 at 14:06
    
open source and compiled. –  Chris Wilson Dec 16 '10 at 14:35
    
well then you don't have to worry about writing some small app/makefile or something, that will relink your program, as oracle does –  xenoterracide Dec 16 '10 at 16:26
add comment

6 Answers 6

up vote 11 down vote accepted

Some points to keep in mind when developing,

  1. Use a standard build system
  2. Avoid hard coding library paths
  3. use tools like pkg-config to find the external packages instead.
  4. If your application has a GUI, use some frameworks like wxWidgets which can render native UI elements depending on where you run.
  5. Avoid creating dependencies with packages which won't run on other distributions.

The only way to fully ensure your application works on all distributions is to actually run and test on it. One way you could do this is by creating virtual machines for each distributions. VirtualBox can be used to do this. I have around 8 virtual machines on my box for this kind of testing.

I think you can't generalize too much on deploying the application as each distribution uses different way of installing packages. Debian uses deb and fedora rpm.

share|improve this answer
3  
just plain avoid hard coding paths, the biggest difference between ALL distro's is their package manager, and where they put things. Assume that they will put every single file and directory in a different place from you. –  xenoterracide Dec 16 '10 at 16:31
add comment

Just my 2c, but I have had less headaches with applications that either come with packages in the official repositories or that are compiled from source. Applications that are distributed as 3rd party binaries tend to suffer from some dependency issues. I will usually need to track these down and resolve them manually.

So, if I were to release a Linux app, I would either work to package it and get it into the official repositories. Otherwise, I would distribute it in source form and have the user compile it for their system.

share|improve this answer
add comment

If you're writing for non-embedded Linux, the main thing to keep in mind is that different distributions will have a different collection of library versions. So you should set a sufficiently old baseline. As Debian updates slowly, Debian stable (or oldstable when it exists, in the few months after a release) tends to be a reasonable choice.

You'll need to package separately for each distribution. If your application is open source and at all successful, you can count on someone picking it up and contributing the packaging, so it's not an essential skill. Other than packaging, the differences between distributions mostly affect system administration, not development or daily use.

If you're going to patch the kernel, you'll have to test with more distributions as each distribution has their own patches that could cause incompatibilities and each distribution has userland settings that may rely on different sets of kernel interfaces being available (e.g. requirements for some things not to be modules).

Note that what I wrote above is not true if you want your application to work on embedded systems (here meaning anything that's not a server, desktop or laptop), which even when they run a Linux kernel often don't have the usual libraries, starting with Glibc being eschewed in favor of µClibc, dietlibc, Bionic, etc.

share|improve this answer
add comment

I've found the Linux Standards Base to be helpful, especially when your application includes services (daemons). See some of these sites:

But if I had to be limited to just resource, it might be the File Hierarchy Standard.

share|improve this answer
add comment

Distros differs mostly in packaging and application defaults/configurations. Every code which runs in a determinated architecture should run on every distro for that architecture. Also you can easily run GNOME apps in KDE and vice-versa, so you can choose one that fits best you/your userbase and you're done!

share|improve this answer
add comment

The main thing is choosing a language. What language will this be run in? If you really want to run on any linux distro, you could write it in Python. Any python app that will run on linux will (basically) run on any linux distro with 0 modifications.

Python also has really nice GTK and Qt binders. I've never worked with gtk, but PyQt is really great to work with.

The benefits to python is that you'll probably not need to compile any extensions (it totally depends on what you're writing though. Even if you do need to, it's pretty easy.) and you also have a great distribution source via pypi. Installing python programs from there is usually even easier than the distro package repository.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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