Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6569471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:37:52+00:00 2026-05-25T14:37:52+00:00

Is it possible to compile a C/C++ source code that executes in all Linux

  • 0

Is it possible to compile a C/C++ source code that executes in all Linux distributions without recompilation?

If the answer is yes, can I use any external (non-standard C/C++) libraries?

I want distribute my binary application instead of distribute of source code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:37:53+00:00Added an answer on May 25, 2026 at 2:37 pm

    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.

    1. Compile 32-bit. Compile for the minimum CPU level you’re willing to support.

    2. Build your own version of glibc. Use the --enable-kernel option to set the minimum kernel version you’re willing to support.

    3. Compile all other libraries you plan to use yourself. Use the headers from your glibc build and your chosen CPU/compiler flags.

    4. Link statically.

    5. 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.

    6. Test thoroughly on all the platforms you need to support.

    You may need to tweak some libraries if they call functions that cannot work with this mechanism. That includes dlopen, gethostbyname, iconv_open, 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.)

    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.)

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to compile a linux kernel(2.6) module that includes functionality defined by
Is it possible to cross-compile D source code for MIPS? For example, I want
Is it possible to compile and run OpenGL programs from under Cygwin? If yes,
Is it currently possible to compile Python and PyObjC for the iPhone such that
Question: Is it possible to compile a program on linux using a .dll file?
I know that it is possible to add swf metadata to the compile command
Is it possible to use Runtime.getRuntime().exec(cmd.exe); in gwt? When I compile it, I get
Possible Duplicate: How to cross compile from Mac OS X to Linux x86? I
Hi I have source code that ant builds into a javaSE jar, and we
I am trying to compile the following very very simple piece of source code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.