How to build applications for older Linux distributions and avoid fatal errors: kernel too old error?
I distribute a statically linked binary version of my application on Linux. However, on a system with a 2.4 kernel, I get a segfault on startup with the message: “Fatal: Kernel too old.”
How can I easily get the 2.4 kernel version up and running? Some of the libraries I needed weren’t even available on older Linux distributions circa 2003. Is there an apt-get install or something that would allow me to easily target the old kernel?
The easiest way to do this is to simply install VirtualBox (or something similar, such as VMWare), installed CentOS 3 or any suitable old distribution with a 2.4 kernel and build/test your application on it.
Since you get “too old a kernel”, you may be relying on some features that are not present in the 2.4 kernel, so you have to track it down and reprocess it.
The error may just be caused by statically linking to glibc, you can try to dynamically link to glibc and statically link to all other libraries, but to be backwards compatible you have to build your application on an older glibv system. Using lsb build tools also helps