How to Compile a Program in Linux

Download the source code for the program or driver from the Internet or other media., Unpack the downloaded code- for .zip files use "unzip your file", for .tgz or .tar.gz use "tar -zxvf yourfile"; for .bz2 use "tar -jxvf yourfile"; or extract your...

10 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Download the source code for the program or driver from the Internet or other media.

    It will most likely be in the form of a "tarball" and have a file extension of .tar, .tar.bz2, or .tar.gz.

    Sometimes a .zip file will be used instead however.
  2. Step 2: Unpack the downloaded code- for .zip files use "unzip your file"

    ,, Arguments such as "
    --prefix=" can be used to control the install location.

    This checks that you have the right libraries and versions. , An executable for the program will be created in the bin directory inside the source code directory. ,,
  3. Step 3: for .tgz or .tar.gz use "tar -zxvf yourfile"; for .bz2 use "tar -jxvf yourfile"; or extract your files graphically.

  4. Step 4: In the terminal

  5. Step 5: move into the newly extracted directory (cd dirName).

  6. Step 6: Run the command "./configure" to configure the source code automatically.

  7. Step 7: Once configured

  8. Step 8: run "make" which does the actual compiling (this can take anything from a few seconds to many hours).

  9. Step 9: To install the program- run "make install".

  10. Step 10: You have compiled and installed the program source code.

Detailed Guide

It will most likely be in the form of a "tarball" and have a file extension of .tar, .tar.bz2, or .tar.gz.

Sometimes a .zip file will be used instead however.

,, Arguments such as "
--prefix=" can be used to control the install location.

This checks that you have the right libraries and versions. , An executable for the program will be created in the bin directory inside the source code directory. ,,

About the Author

B

Brandon Murphy

Specializes in breaking down complex DIY projects topics into simple steps.

64 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: