Linux: How to compile program
Many newbies find it difficult to compiling programs under Linux (command mentioned below should also work with FreeBSD or any other UNIX like system). The fact that Linux is open source OS, so most of the programs are also open sources. Improvements and security, bug patches needs to us compile not just Kernel but softwares/programs. Please note that you can download program with wget and extract the file with tar command.
If file extensions is .gz then use tar command as follows to extract tar ball:
$ tar -zxvf file.tar.gz
If file extensions is .bz2 then use tar command as follows to extract tar ball:
$ tar -jxvf file.tar.bz2
Three common steps to compiling program under Linux:
Step # 1: Configure (read as prepare) the program for compile on your system/architecture.
Generally configure command is used:
$ ./configure
Step # 2: Compiling the program
Use make command to compiling program:
$ make
Step # 3: Install the program
First become a root user:
$ su -
Password:YOUR-PASSWORD
Next install the software with following command:
# make install
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- FreeBSD > Compiling application with QT
- Howto: Apache adding new modules
- Howto: build Linux kernel module against installed kernel w/o full kernel source tree
- Howto: Connect MySQL server using C program API under Linux or UNIX
- How to compile a 32-bit application using gcc on the 64-bit Linux version
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: compile source code, how to compile c++ program, how to compile linux program, make command, su command, tar command



If file extensions is .bz2 then use tar command as follows to extract tar ball:
$ tar -jxvf file.tar.gz
I am guessing it should be .bz2 insteat of .tar.gz
thanks for the heads up!