Typically even old programs (copied from systems with Linux kernel version 2.4) just run file on modern Linux systems, unless they depend on a lot of libraries or use frameworks.

New programs, (often even int main(){return 0;}) often fail to run if copied to an old system.

How do I make such dynamically linked executables on a modern system? I don't want to set up old system in chroot or virtual machine. Is it possible to "cross-compile" for old library?

1 Answer 1


Setting up the old system in a separate environment (chroot or VM) is the easiest way. (Under Debian, schroot and debootstrap make this easy; see How do I run 32-bit programs on a 64-bit Debian/Ubuntu?)

It is possible to cross-compile for old library versions: “simply” install the development packages for these old libraries, and point your compiler to them. You may need to recompile the compiler itself to accommodate an older standard library. The difficulty is in getting all of the development packages properly installed and configured. You need to:

  1. Compile an old standard library.
  2. Compile library A, pointing your compiler to the headers and .a files produced in the previous step. (With gcc, pass the -nostdinc and -nostdinc++ options; other compilers typically have similar flags.)
  3. Repeat, following the dependency chain, until you've compiled your program.
  • Why distro or library should I choose to covert the widest range of old and modern systems?
    – Vi.
    Commented May 13, 2015 at 13:24
  • @Vi. Any old release of a distribution that you can install easily will do. With Debian, potato (2000 vintage) is the earliest one that you can install with the current version of debootstrap, but you can install an intermediate version and go back to slink (1999). Going back further with debootstrap might take some fiddling. Commented May 15, 2015 at 14:04

You must log in to answer this question.

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