how to port c/c++ applications to legacy linux kernel versions

前端 未结 2 1849
盖世英雄少女心
盖世英雄少女心 2021-02-07 09:00

Ok, this is just a bit of a fun exercise, but it can\'t be too hard compiling programmes for some older linux systems, or can it?

I have access to a couple of ancient sy

2条回答
  •  既然无缘
    2021-02-07 09:22

    The reason you can't compile it on the original system likely has nothing to do with kernel version (it could, but 2.2 isn't generally old enough for that to be a stumbling block for most code). The problem is that the toolchain is ancient (at the very least, the compiler). However, nothing stops you from building a newer version of G++ with the egcs that is installed. You may also encounter problems with glibc once you've done that, but you should at least get that far.

    What you should do will look something like this:

    • Build latest GCC with egcs
    • Rebuild latest GCC with the gcc you just built
    • Build latest binutils and ld with your new compiler

    Now you have a well-built modern compiler and (most of a) toolchain with which to build your sample application. If luck is not on your side you may also need to build a newer version of glibc, but this is your problem - the toolchain - not the kernel.

提交回复
热议问题