What is the difference between compile code and executable code?

BuildCompilationTerminology

Build Problem Overview


I always use the terms compile and build interchangeably.

What exactly do these terms stand for?

Build Solutions


Solution 1 - Build

Compiling is the act of turning source code into object code.

Linking is the act of combining object code with libraries into a raw executable.

Building is the sequence composed of compiling and linking, with possibly other tasks such as installer creation.

Many compilers handle the linking step automatically after compiling source code.

Solution 2 - Build

From wikipedia:

>In the field of computer software, the term software build refers either to the process of converting source code files into standalone software artifact(s) that can be run on a computer, or the result of doing so. One of the most important steps of a software build is the compilation process where source code files are converted into executable code. > >While for simple programs the process consists of a single file being compiled, for complex software the source code may consist of many files and may be combined in different ways to produce many different versions.

Solution 3 - Build

A build could be seen as a script, which comprises of many steps - the primary one of which would be to compile the code. Others could be

  • running tests
  • reporting (e.g. coverage)
  • static analysis
  • pre and post-build steps
  • running custom tools over certain files
  • creating installs
  • labelling them and deploying/copying them to a repository

Solution 4 - Build

They often are used to mean the same thing. However, "build" may also mean the full process of compiling and linking a whole application (in the case of e.g. C and C++), or even more, including, among others

  • packaging
  • automatic (unit and/or integration) testing
  • installer generation
  • installation/deployment
  • documentation/site generation
  • report generation (e.g. test results, coverage).

There are systems like Maven, which generalize this with the concept of lifecycle, which consists of several stages, producing different artifacts, possibly using results and artifacts from previous stages.

Solution 5 - Build

From my experience I would say that "compiling" refers to the conversion of one or several human-readable source files to byte code (object files in C) while "building" denominates the whole process of compiling, linking and whatever else needs to be done of an entire package or project.

Solution 6 - Build

Most people would probably use the terms interchangeably. You could see one nuance : compiling is only the step where you pass some source file through the compiler (gcc, javac, whatever).

Building could be heard as the more general process of checking out the source, creating a target folder for the compiled artifacts, checking dependencies, choosing what has to be compiled, running automated tests, creating a tar / zip / ditributions, pushing to an ftp, etc...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLazerView Question on Stackoverflow
Solution 1 - BuildIgnacio Vazquez-AbramsView Answer on Stackoverflow
Solution 2 - BuildcodaddictView Answer on Stackoverflow
Solution 3 - BuildGishuView Answer on Stackoverflow
Solution 4 - BuildPéter TörökView Answer on Stackoverflow
Solution 5 - BuildchrisView Answer on Stackoverflow
Solution 6 - BuildphtrivierView Answer on Stackoverflow