Skip to main content

Source code compilation steps - Knowledgebase / Research Systems - SOMTech (Technology Services) - VCU School of Medicine

Source code compilation steps

Authors list

Compile Open-Source Code by End Users

In many cases you will need to compile open source by yourself for your research purpose, if the existing binary is too old or not matching the required kernel or system library version, you can try to compile the source code directly provided by the author, this including C++, G++, Python etc.  

Download the source code from authorized URL using curl, or github, normally it’s in .tar.gz or .tz format

Save it under your $HOME directory or preferred subdirectory, unarchive it by general command line:

$tar -xvf  OPENSOURCE.tar.gz


Use –help to find all of the compilation options and include the necessary parameters including the binary path generated. 

$ ./configure


#C/C++ compilation by default. you can always choose the options to control the optimization for the binary, check the gcc optimization options https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

$ make


Without sudo you can install the binary to your home directory, with sudo, you can have the root privilege to install the binary to system directory.

$ sudo make install

Binary compiled by end users is recommended to be saved under  $HOME/bin, it is by default defined as the public path in front of other system public path, this means if you have two binaries with the same name ( i.e  two different versions of R), the one under your home directory will be called first unless you specify the full path of the other one under system path.


Helpful Unhelpful