As a haskell package, git-annex can be installed using cabal.
This involves building a lot of haskell packages from source, and so it has a lot of moving parts, and it's not uncommon for it to be broken from time to time.
If you are not comfortable tracking down and dealing with library build problems, installing git-annex with cabal is probably not the right choice for you!
prerequisites
Start by installing the Haskell Platform. In Debian, this is as simple as:
sudo apt-get install haskell-platform
minimal build
This builds git-annex without some features that require C libraries, that can be harder to get installed. This is plenty to get started using it, although it does not include the assistant or webapp.
cabal update
PATH=$HOME/bin:$PATH
cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"
full build
To build with all features enabled, including the assistant and webapp, you will need to install several C libraries and their headers, including libgnutls, libgsasl, libxml2, and zlib. Then run:
cabal update
PATH=$HOME/bin:$PATH
cabal install c2hs --bindir=$HOME/bin
cabal install git-annex --bindir=$HOME/bin
building from git checkout
But maybe you want something newer (or older). Then download the version you want, and use cabal as follows inside its source tree:
cabal update
PATH=$HOME/bin:$PATH
cabal install c2hs --bindir=$HOME/bin
cabal install --only-dependencies
cabal configure
cabal build
cabal install --bindir=$HOME/bin
EKG
When building with cabal, you can optionally enable the EKG monitoring interface. This is great for debugging resource usage problems.
After finishing the installation the cabal way, here are the packages I installed. It is possible that there are other packages I installed previously as dependency for other packages.
I get an error from the command as above: $ sudo apt-get install cabal-install libgnutls28-dev libgsasl7-dev c2hs libghc libxml-sax-dev zlib1g-dev libghc-zlib-dev
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.2 LTS Release: 12.04 Codename: precise
If you're installing git-annex with cabal, there is no need to install any haskell library packages with apt-get. That includes libghc-libxml-sax-dev and libghc-zlib-dev. Without those, the apt-get line may work to install the C libraries needed for cabal to install the haskell libraries.
However, see the the Ubuntu page for much easier ways to get git-annex installed.
@Joey Many thanks. I am new to Haskell (vaguely looked at it with DARCS) and git-annex. After installing with apt-get on Ubuntu 12.04 LTS I found webapp was missing, hence have come here. I am going through the correct steps now, it should be awesome when done.
This seems to be a long build process (still going on my old laptop, much longer than apt-get). Ubuntu git-annex packages from 13.10 Saucy I think are updated to include webapp.
I'm having problems installing from cabal, and it seems related to yesod. I found an older discussion on something similar, where a constraint to require a newer version of yesod had been added, but I haven't figured out what was done to solve it.
The problem seems to be that git-annex requires yesod < 1.2, but cabal is unable to install an older version.
From what I can tell, the problem is fixed in github master since yesod >= 1.2 is supported again.
I had - maybe the same problem as Nigel - with ExitFailure 1 libxml-sax-0.7.4 .
I could fix this by forcing the link of libxml2 package with "brew link libxml2 --force". Maybe you should update your guide. I had this problem on 2 different machines running both the current versions of OS X.
After this the build finished successfull. Maybe this helps.
I tried various ways to install git-annex on my TonidoPlug.
System Info:
apt-get
didn't work.The Linux standalone installation results in an error message like this, when calling
git-annex
(orgit annex
)(git-annex.linux/bin/git-annex is a binary file and works fine on other distros)
When installing with cabal, I get the error message (tried as root and gitolite user)
Any help is appreciated. Thanks for providing git-annex. I started cleaning up my backups with it yesterday and really like it.
The Linux standalone builds for i386 and amd64 will not work on Arm systems.
There are builds of git-annex for arm in eg, Debian. You should be able to use one of those if this system is running Debian. You may need to upgrade to eg, Debian stable, which includes git-annex.
It looks like you have an old and/or broken GHC compiler too. You could upgrade that to a newer version (eg from Debian stable) and build it that way, but it seems like the long way around if you have a Debian system there.
I had problems following these directions on recent releases of Fedora/Ubuntu. The install attempts failed on cryptocipher-0.3.1, which I think came as a dependency of Yesod. I was able to work around this by installing yesod-platform with cabal first, then installing git-annex.
The git-annex assistant can easily be built on arm. But not the webapp. It's entirely possible to use the assistant without the webapp though; you just have to make the git repository and configure the remotes by hand, and then the assistant will sync them the same way the webapp does.
It is possible but very involved to build the webapp for arm. I do not anticipate doing it in the Debian package until ghc gets proper template haskell support for arm. See Webapp on ARM
Thanks for the quick answer. I will try to build git-annex with just the assistant, as you suggest, and once it works set up the server by hand as you suggest.
BTW: Awesome job you're doing with git-annex. I appreciate your enthusiasm.
It took a while and a few tries, but I finally built the git-annex binary including the assistant on a Raspberry Pi. The build comes without the flags webapp, webdav, and dbus as these rely on a Template Haskell compiler that hasn't been ported to Arm architecture yet.
I put the binary up on Github in case anyone's interested: https://github.com/tradloff/git-annex-RPi
I now realize there is a Ubuntu 12.04 Precise PPA with a current version of git-annex, so that's probably a better choice, but here's how I cabal isntalled git-annex.
Apt install non-cabal dependencies:
Manually cabal install yesod-platform to avoid the cryptocipher problem mentioned above:
Cabal install git-annex with DNS flag disabled:
I was getting this error building git-annex before disabling the DNS flag:
Looking at Utiltity/SRV.hs, it appears that disabling the DNS flag just makes git annex use a different DNS library (ADNS), not actually disable DNS lookups.
$ cabal install *
commands again?Lately I get this error message when trying to build git-annex-v4.20131002:
crypto-api-0.10.2 is installed as a debian dev package. All the dependencies are met. I have no idea what's going on.
configure -f-CryptoHash
if it's for some reason failing to disable the cryptohash support despite the declared dependency not being met.Okay, the error doesn't show up anymore. I didn't even get to Cronner though, because this time I got a different error:
This is from trying to compile 4.20131101 with
-f"-webapp -webdav"
Unfortunate about that. I've fixed it in git.
(It would be best to file bug reports about build failures to avoid cluttering up this page.)
After a fresh install of Haskell, and following the instructions above, I end up with the following rather bizarre and unexpected problem:
(followed by an error for every other macro that was expected to be defined in the header...)
This is a somewhat older Mac OS X 10.6.8 system.
I do have PCRE already installed via Fink, and pcre.h is in /sw/include. I see other -I/sw/... things in the compile command above, but obviously /sw/include is not one of them.
Any clues for me?
(Why the heck does git-annex need pcre in particular anyway??? I saw another regex library get installed earlier somewhere in this (massive) process.)
The PCRE problem is solved trivially in my case with a couple more cabal install options, though the need for these seems oddly dissatisfying given the reams of other stuff that was successfully built and installed without these options.
Now however I seem to have encountered a deeper problem:
I'm using the ghc7.0 branch because Fink's GHC is still at 7.0.4....
@robohack, the ghc7.0 branch is not being maintained, and is so old I don't recommend it. To build it against current cabal you will probably need to version its dependency on network to an older version than 2.4.0.
Also, git-annex has not depended on pcre for a long time. But you're building thoroughly old version so get to trip over every bug that's been reported for the past 2 years..