Gcc C compiling and linking for older kernel

Dear community

I’m trying to set up an OpenSuse 15.4 as a cross-compiling machine for a C project that will run on a tinycore linux with a somewhat outdated kernel.

I managed to compile and run both 32bit and 64bit, static linked binary on the OpenSuse, but when I go to run the binary on the target machine I get an error: FATAL: kernel too old

From what I understand the problem is that the glibc distributed with OpenSuse are too new, and are not compatible with the 2.6.33 kernel of the target system.

Does anyone know how to compile a binary that is compatible with an older kernel? Can you point me in the right direction?

You need suitable target development environment (at least glibc) to compile against. You cannot link cross-compiled program against host glibc, this destroys the very idea of cross-compilation.

Well, this sounds logical, but how to do it?

Is there any pre-compiled package to install? Or do I have to download the src and compile it? Or do I copy the libraries from the target machine to the host machine? Which is the correct way?

And once I have a suitable target dev env, how to tell gcc/linker to use this one for building and linking instead of host one?

That question is better asked on support channels for your target distribution. They must have some tools to build it.

1 Like