Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No, you can't compile an executable the executes in all Linux distributions. However, you can compile an executable that works on most distributions that people will tend to care about.</p> <ol> <li><p>Compile 32-bit. Compile for the minimum CPU level you're willing to support.</p></li> <li><p>Build your own version of glibc. Use the <code>--enable-kernel</code> option to set the minimum kernel version you're willing to support.</p></li> <li><p>Compile all other libraries you plan to use yourself. Use the headers from your glibc build and your chosen CPU/compiler flags.</p></li> <li><p>Link statically.</p></li> <li><p>For anything you couldn't link to statically (for example, if you need access to the system's default name resolution or you need PAM), you have to design your own helper process and API. Release the source to the helper process and let them (or your installer) compile it.</p></li> <li><p>Test thoroughly on all the platforms you need to support.</p></li> </ol> <p>You may need to tweak some libraries if they call functions that cannot work with this mechanism. That includes <code>dlopen</code>, <code>gethostbyname</code>, <code>iconv_open</code>, and so on. (These kinds of functions fundamentally rely on dynamic linking. See step 5 above. You will get a warning when you link for these.)</p> <p>Also, time zones tend to break if you're not careful because your code may not understand the system's zone format or zone file locations. (You will get no warning for these. It just won't work.)</p> <p>Most people who do this are building with the minimum supported CPU being a Pentium 4 and the minimum supported kernel version being 2.6.0.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload