Sunday, January 15, 2017

a basic doubt about building from source



Suppose I installed a Debian package using the Ubuntu Software Center, and then suppose I wish to install the same program by compiling it from source. Then can I simply proceed by installing the same program compiling from source? Will this replace the previous version installed via deb package?



Debian packages generally install the binaries and libraries in /usr/bin/ and /usr/lib directories. Whereas when you compile the softwares from source, you are able to specify the prefix for the directories in which you want to install it. In general, the /usr/local/bin/ and /usr/local/lib directories are default in standard gnu softwares / foss (sort of de-facto standard). You can compile the softwares by specifying the prefix while running configure command.
e.g. Say you want to install the software in /usr/local/ prefix, you should run these commands:





  1. ./configure --prefix=/usr/local

  2. make

  3. sudo make install



You can specify --prefix to be any directory e.g. it can be ~/.local/ or any other directory for that matter.
Now you have two binaries with the same name but in different directories installed. Which one of these will be used when you invoke the command (binary file) name, depends on the PATH variable of your shell. If the directory you installed the software is before the standard /usr/bin/ directory in the PATH variable value, it'll be run and debian one'll not be run.
Check the PATH variable by running echo $PATH in terminal.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...