Danny Willems -- Work In Progress

A mathematician fighting for privacy and security on the Internet, while dreaming about describing the Universe with equations and symbols.

Research Publications Public Talks Open source software contributions CV Education Blog PGP public key Recommended softwares Contact Proton calendar for cryptography and cybersecurity events
17 May 2017

Compile from source and install it in your home.

by Danny Willems

Since several months, I would always like to build software from source. It began when I would install vim 8.0 but no packages for Ubuntu were available. I wrote an article about it.

I began by building from source and install it with sudo. But, I had some issues when the package was updated because there were some conflicts. For these reasons, I decided to build from source and to install the binaries in a separated directory in my home, called $HOME/.bin/. When the binaries are installed in this directory, I only need to extend my PATH with the appropriate subdirectories.

Here some example.

Git

In Ubuntu, the version provided by packages is 2.7.4 from 2016. The current version if 2.13. All source codes I need are in a directory called $HOME/.source. I use the following commands to build git from source and install it locally.

mkdir -p $HOME/.source
git clone https://github.com/git/git $HOME/.source/git
cd $HOME/.source/git
./configure --prefix=$HOME/.bin/git
make -j 8
make install

The usual commands to build C programs are ./configure && make && make install and you can pass some arguments like –prefix=path to ./configure to change the directory where the binaries must be installed.

Emacs

Even if I’m a vim user since several years, I switched to Emacs some months ago. I also want to have the latest version and I use the following commands.

mkdir -p $HOME/.source
git clone https://github.com/emacs-mirror/emacs $HOME/.source/emacs
cd $HOME/.source/emacs
./configure --prefix=$HOME/.bin/emacs
make -j 8
make install

Usually you will easily find the commands to build. If configure is used, you can often use the flag --prefix (it is recommended by the GNU project to always add it when you provide a configure script). I personally recommend it to avoid conflicts and to easily remove the version you don’t want to use anymore.

Hope it can help you.

tags: Tips - RSS