Sunday, December 13, 2015

Build git from source on Ubuntu

Install git from source on a linux/unix based system, we need to pre-install some dependent libraries:

1. tcl/tk

sudo apt-get install tcl-dev

2. gettext
otherwise, we will get an error message like this:
/bin/sh: 1: msgfmt: not found                                   Makefile:2069: recipe for target 'po/build/locale/pt_PT/LC_MESSAGES/git.mo' failed                                  
make: *** [po/build/locale/pt_PT/LC_MESSAGES/git.mo] Error 127

sudo apt-get install gettext

3. libcurl
This lib is for https support. This means you can clone repo from https:// 

You can use apt-get to install curl:



sudo apt-get install libcurl-dev
or build curl of latest version from souce tarball: curl-7.46.0.tar.gz
and make sure ssl is enabled(for https support)

/configure --with-ssl
make
sudo make install
Note:If you failed on build curl with ssl support, you can do:
sudo apt-get install libssl-dev

after that, build git
tar xf git-2.6.4.tar.gz
cd git-2.6.4

./configure
make
sudo make install



After you build curl, you can test whether https: is supported or not by:

curl https://github.com
Note:
1) if you don't install gettext before you build git, then you probably will encounter such errors when you do make command,
even if you specify an option like ./configure --without-tcltk you still will get a error like this:

after you do apt-get install gettext, all these errors will be fixed.

2) If you don't install libcurl, then when you clone a repository like this:
git clone https://github.com/xxx/abc.git
it will pop an error saying:
Cloning into gitflow...
fatal: Unable to find remote helper for 'https'
just install libcurl and rebuild git will solve this error.

No comments:

Post a Comment