Compiling C++ into portable linux binaries

前端 未结 4 1980
清酒与你
清酒与你 2021-02-14 02:02

Ok, this question is about portable as in no dependencies (i.e. \"I can put the binaries in a USB key and bring it with me everywhere, e-mail t

4条回答
  •  隐瞒了意图╮
    2021-02-14 02:45

    To disappoint you: there is no solution to it. That statically link is there, and you can (if you want) link everything static => all dependencies from other libraries are removed. But there are other dependencies, which cant be avoided: First there is the architecture. We have here linux on PowerPC, linux on ARM, linux on Microblaze, linux on 32-bit x86, and linux on 64-bit x86. Secondly there is the the ABI and there syscalls. Those can (and indeed have in the past) change (e.g. exotic/new syscalls does not exist on old systems - and if you got those calls in your binary your program wont work).

    The LSB is just a a standard (or better it tries to be - not everyone follows it) for the different distros to make adminstration, usage, and maintaining (and sometimes developing) easier by e.g. defining where which files are stored. It does not aim to make executables more portable.

提交回复
热议问题