git-annex/ install/ fromsource

So you want to build git-annex from source. This is encouraged for users with experience building code from source. But the build may require some care and feeding. This page will start with the easy methods and work up to the harder ones.

This page also covers installing git-annex from source, but in many cases it's better to install it using your OS's package manager.

## downloading the source code

The easiest way is using git; see download or just run:

    git clone git://git-annex.branchable.com/ git-annex

## building from source on Debian

This is the method used by git-annex's author, and so it's the one most likely to work without problems.

First, install everything git-annex needs to build:

    sudo apt-get build-dep git-annex

Now you can build git-annex by running `make` inside the source tree.

Then, to install the program and associated files system-wide in `/usr/local`, run:

    sudo make install PREFIX=/usr/local

Or, to install the program into $HOME/.local/bin, and associated files into other parts of your HOME directory, run:

    make install-home

## building from source with stack

Using stack automates nearly everything, will work on many systems, and avoids build failures due to fast-changing haskell libraries.

First, install stack
On Debian:

    sudo apt-get install haskell-stack zlib1g-dev

Get the git-annex source code, and inside the source tree run:

    stack setup
    stack build

To install the program and all associated files system-wide in `/usr/local`, run:

    sudo make install BUILDER=stack PREFIX=/usr/local

Or, to install the program into $HOME/.local/bin, and associated files into other parts of your HOME directory, run:

    make install-home BUILDER=stack

(Why not run `stack install git-annex`? Because that causes stack to ignore git-annex's stack.yaml file, yielding a less reliable build. Stack also only installs the binary, and not other files.)

Note that this build produces a git-annex without the build flags DBUS and MagicMime. These optional features require installing additional C libraries. To try to build with these features enabled, pass extra parameters when running `stack build`: `--flag git-annex:DBUS --flag git-annex:MagicMime`

## minimal build from source with cabal

This can be done anywhere, and builds git-annex without some optional features that require harder-to-install C libraries. This is plenty to let you get started with git-annex, but it does not include the assistant or webapp.

Be warned that this involves building a lot of Haskell libraries 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.

Get the git-annex source code, and inside the source tree, run:

    cabal install -j -f"-assistant -webapp -pairing -dbus -magicmime" --only-dependencies
    cabal configure -f"-assistant -webapp -pairing -dbus -magicmime"
    cabal build -j

To install the program and all associated files system-wide in `/usr/local`, run:

    sudo make install BUILDER=cabal PREFIX=/usr/local

Or, to install the program into $HOME/.local/bin, and associated files into other parts of your HOME directory, run:

    make install-home BUILDER=cabal

## full build from source with cabal

To build with all features enabled, including the assistant and webapp, you will need to install several C libraries and their headers, including libmagic, and zlib. How to do that for your OS is beyond the scope of this page.

Once the C libraries are installed, run inside the source tree:

    cabal install -j --only-dependencies
    cabal configure
    cabal build -j

To install the program and all associated files system-wide in `/usr/local`, run:

    sudo make install BUILDER=cabal PREFIX=/usr/local

Or, to install the program into $HOME/.local/bin, and associated files into other parts of your HOME directory, run:

    make install-home BUILDER=cabal

libxml-sax Error on OS X fresh install

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.

Comment by https://www.google.com/accounts/o8/id?id=AItOawl7dGdYtCHb7xleEOp6n8yaUQ4UtaiAEEs — Wed Oct 29 14:05:27 2025
comment 8
git-annex 4.20130621 once again builds with the current version of yesod.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
comment 75

Can I make armv7 version for alpine Linux? Or WASM? `git-annex` can't run on iOS without jailbreak. The only way is to build it on iSH or A-shell.

git-annex(aarch64) is already provided on alpine repo. But iSH supports only armv7. So I can't install git-annex. I tried to build ghc for armv7. But the Haskell foundation has dropped supporting the armv7 since ghc-9.

A-shell needs WASI binary. I tried ghc-wasm-meta to compile git-annex to WASI binary, But I couldn't handle package version conflicts inside git-annex.

Comment by TTTTAAAx — Wed Oct 29 14:05:27 2025
Warning building with cabal

I had to build with cabal on DragonFlyBSD because stack isn't available (which is presumably the reason it's not in dports even though it builds cleanly.)

Everything worked after, except all the cabal commands gave warnings of the type:

> Warning: The install command is a part of the legacy v1 style of cabal usage.

> Please switch to using either the new project style and the new-install command or the legacy v1-install alias as new-style projects will become the default in the next version of cabal-install. Please file a bug if you cannot replicate a working v1- use case with the new-style commands.

> For more information, see: https://wiki.haskell.org/Cabal/NewBuild

I don't know much about "new style" and "legacy" commands in cabal, but instructions should probably be cleaned up to get around these warnings at some point.

Comment by driusan — Wed Oct 29 14:05:27 2025
Windows build with stack

1. git checkout failed,

fatal: cannot create directory at

'doc/bugs/Assertion96cnt 60 40sizeof 40 95nl95value95type95LC95TIME41 47sizeof40 95nl95value95type95LC95TIME91093 41 41 39failed.': Filename too long

fixed by updating longpaths in gitconfig,

1. stack setup ok

2. stack install failed,

regex-tdfa-1.2.3.1: copy/register Progress 58/168 removeDirectoryRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:RemoveDirectory

Will have to try the Make approach on Windows ?

Comment by prabindh — Wed Oct 29 14:05:27 2025
comment 72

@joey, What I have is just the builds I get from gentoo respective the haskell overlay. The most current version in that overlay is 6.20180626 but it also does not compile.

I need a version more recent than 6.20170818 as that version does still use rsync for remote copy.

Comment by Mowgli — Wed Oct 29 14:05:27 2025
comment 71

@Mowgl, I see from the errors that whatever version of git-annex you're trying to build is at least somewhat out of date, since Utility.SRV was removed last month. The Utility.Mounts problem has also been fixed in newer versions.

hostAddressToTuple has been provided by all versions of the network package that git-annex.cabal allows it to build with, so you must have forced it to build with an older, unsupported version.

Anyway, there is nothing that prevents using git-annex 6.20170818 from working with any newer version of git-annex, unless you are using a couple of features added in newer versions.

Comment by joey — Wed Oct 29 14:05:27 2025
Logs
Sorry, your comment system ate up all the linebreaks and make all that beautiful error logs unreadable. :-(
Comment by Mowgli — Wed Oct 29 14:05:27 2025
Could not resolve dependencies for yesod

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.

    $ cabal install git-annex --bindir=$HOME/bin
    Resolving dependencies...
    cabal: Could not resolve dependencies:
    trying: git-annex-4.20130601
    trying: git-annex-4.20130601:+webapp
    rejecting: yesod-1.2.1.1, 1.2.1, 1.2.0.1, 1.2.0 (conflict:
    git-annex-4.20130601:webapp => yesod(<1.2))
    trying: yesod-1.1.9.3
    $

From what I can tell, the problem is fixed in github master since yesod >= 1.2 is supported again.

Comment by krig — Wed Oct 29 14:05:27 2025
Gentoo-Build (Haskell nightmare)

I try to build git-annex on Gentoo linux (the most current version to be able to interact with the same version on debian). Unfortunatelly the version in Gentoo itself is to old (6.20170818).

So I found the haskell overlay that includes newer libraries for haskell as well as git-annex version 6.20180626.

So for 3 days now I try to get the haskell stack compiled what failed many times with circular dependencies, conflicting versions or simply not working haskell versions. It was a real nightmare and only a hint from the mailinglist to simply allow any haskell library, even all broken ones, gave me the solution to fulfile all dependencies for git-annex.

But now, git-annex itself fails to compile. I have no idea how to solve that.

Here the relevant logs: ./setup configure --ghc --prefix=/usr --with-compiler=/usr/bin/ghc --with-hc-pkg=/usr/bin/ghc-pkg --prefix=/usr --libdir=/usr/lib64 --libsubdir=git-annex-6.20180626/ghc-8.4.3 --datadir=/usr/share/ --datasubdir=git-annex-6.20180626/ghc-8.4.3 --ghc-options=-j2 +RTS -A256M -qb0 -RTS --with-ar=x86_64-pc-linux-gnu-ar --ghc-option=-optc-march=native --ghc-option=-optc-O2 --ghc-option=-optc-pipe --ghc-option=-optl-Wl,-O1 --ghc-option=-optl-Wl,--as-needed --disable-executable-stripping --docdir=/usr/share/doc/git-annex-6.20180626 --verbose --enable-shared --enable-executable-dynamic --sysconfdir=/etc --disable-library-stripping --flag=-android --flag=-androidsplice --flags=-assistant --flags=-benchmark --flags=concurrentoutput --flags=-dbus --flags=magicmime --flags=network-uri --flags=pairing --flag=-production --flags=-s3 --flag=-testsuite --flags=torrentparser --flags=-webapp --flags=webdav … Assistant/Threads/MountWatcher.hs:36:2: error: warning: #warning Building without dbus support; will use mtab polling [-Wcpp] #warning Building without dbus support; will use mtab polling ^~~~~~~ | 36 | #warning Building without dbus support; will use mtab polling | ^

Assistant/Threads/NetWatcher.hs:27:2: error: warning: #warning Building without dbus support; will poll for network connection changes [-Wcpp] #warning Building without dbus support; will poll for network connection changes ^~~~~~~ | 27 | #warning Building without dbus support; will poll for network connection changes | ^

BuildFlags.hs:22:2: error: warning: #warning Building without the assistant. [-Wcpp] #warning Building without the assistant. ^~~~~~~ | 22 | #warning Building without the assistant. | ^

BuildFlags.hs:27:2: error: warning: #warning Building without the webapp. You probably need to install Yesod.. [-Wcpp] #warning Building without the webapp. You probably need to install Yesod.. ^~~~~~~ | 27 | #warning Building without the webapp. You probably need to install Yesod.. | ^

BuildFlags.hs:43:2: error: warning: #warning Building without S3. [-Wcpp] #warning Building without S3. ^~~~~~~ | 43 | #warning Building without S3. | ^

Utility/DirWatcher.hs:42:2: error: warning: #warning "Building without inotify support" [-Wcpp] #warning "Building without inotify support" ^~~~~~~ | 42 | #warning "Building without inotify support" | ^ … Utility/IPAddress.hs:20:48: error: Variable not in scope: hostAddressToTuple :: HostAddress -> (Integer, b0, c0, d0) | 20 | isLoopbackAddress (SockAddrInet _ ipv4) = case hostAddressToTuple ipv4 of | ^^^^^^^^^^^^^^^^^^

Utility/IPAddress.hs:26:53: error: Variable not in scope: hostAddress6ToTuple :: HostAddress6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) | 26 | isLoopbackAddress (SockAddrInet6 _ _ ipv6 _) = case hostAddress6ToTuple ipv6 of | ^^^^^^^^^^^^^^^^^^^

Utility/IPAddress.hs:39:47: error: Variable not in scope: hostAddressToTuple :: HostAddress -> (Integer, Integer, Integer, Integer) | 39 | isPrivateAddress (SockAddrInet _ ipv4) = case hostAddressToTuple ipv4 of | ^^^^^^^^^^^^^^^^^^

Utility/IPAddress.hs:49:52: error: Variable not in scope: hostAddress6ToTuple :: HostAddress6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) | 49 | isPrivateAddress (SockAddrInet6 _ _ ipv6 _) = case hostAddress6ToTuple ipv6 of | ^^^^^^^^^^^^^^^^^^^

Utility/IPAddress.hs:70:22: error: Variable not in scope: htonl :: Integer -> t | 70 | toipv4 a b = htonl $ fromIntegral a * (2halfipv4bits) + fromIntegral b | ^^^^^ … Utility/Mounts.hs:13:1: error: Could not find module `System.MountPoints' Use -v to see a list of the files searched for. | 13 | import qualified System.MountPoints | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Utility/Mounts.hs:14:1: error: Could not find module `System.MountPoints' Use -v to see a list of the files searched for. | 14 | import System.MountPoints (Mntent(..)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ … Utility/SRV.hs:18:1: error: Could not find module`Network.DNS.Lookup' Use -v to see a list of the files searched for. | 18 | import qualified Network.DNS.Lookup as DNS | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Utility/SRV.hs:19:1: error: Could not find module `Network.DNS.Resolver' Use -v to see a list of the files searched for. | 19 | import Network.DNS.Resolver | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Full logs via e-mail.

As you can see, I try to compile without assistant and without webapp as I never use that two subsystems. From the ebuild file, that should exclude them via cabal flags and does not install the dns library (beside others).

Bt git-annex seems to ignore the cabal flags and try to install all the excluded stuff nevertheless (like s3, assistan or webapp).

Help! How to get out of the Haskell nightmare!?

Comment by Mowgli — Wed Oct 29 14:05:27 2025
comment 68

@erics, thanks for the useful feedback about stack. I've applied your patch to avoid the Build/InstallDesktopFile problem. And, I made it automatically set GHC when BUILDER=stack.

Using the Makefile is documented, up in the "building from source on Debian" section. But there's a set of users who want to use stack, and don't want to mess around with Makefiles (including users on Windows without a "make"), and that's who the stack instructions are kind of targeted at. It's an unfortunate problem with stack that it doesn't provide any way to make the git-annex-shell symlink.

I am doubtful that --allow-different-user is a good idea. I sometimes use stack to build git-annex for testing purposes, but I have never built it with stack and installed that with `sudo make install`. And it may well be that there's not a reasonable way to make that work; and the install target is mostly intended for use by distributions that are creating a package of git-annex, who probably set PREFIX and don't run it as root.

Comment by joey — Wed Oct 29 14:05:27 2025
Woops, just found the "contributing" page...
... so I have the answer to my question about how to submit patches.
Comment by erics — Wed Oct 29 14:05:27 2025
Adventures with stack

I've played with git-annex before, but never used it seriously. Building it from source for the first time, to get the latest and greatest, I ran into a few stumbling blocks. I've got them sorted out now; this is to (a) document them, and (b) ask which if any of these should be considered bugs -- in which case I'll file bug reports about them.

I'm a complete Haskell newbie, and don't want to dive into that right now, so I'm using stack, since I like the sound of

> Using stack automates nearly everything, will work on many systems, and avoids build failures due to fast-changing haskell libraries.

I'm working with Ubuntu 16.04 LTS, stack 1.5.1, ghc 8.0.2 (courtesy of stack), and git-annex 6.20171026.

So, here's how things went.

Almost following the stack section of fromsource, after `stack setup` I did `stack build` instead of`stack install`, so that I could (a) run the tests before installing, and (b) install into /usr/local as root.

Issue #1: `stack test` doesn't run the tests. It took me a while to find `git annex test`. This isn't a bug, just something for people to be aware of.

Issue #2: `stack build` doesn't create the git-annex and git-annex-shell symlinks. Which means that the ssh remote tests fail.

Issue #3: Unless they don't. If ./git-annex-shell doesn't exist, the tests use whatever copy they find on $PATH. Which lets them run -- but it's not testing the code you think it's testing. This could lead to either false negatives or false positives under different circumstances.

I'd noticed the Makefile, but dismissed it after a failed attempt to set `BUILDER=stack`, especially since it's undocumented. Turns out it does important stuff -- like creating those symlinks. So I dug more deeply. The magic incantation is:

    make BUILDER=stack GHC="stack ghc --" [target]

The "--" is the unobvious bit.

There's even a `make test`.

Issue #4: The Makefile does good and useful things, but I can find no mention of it in fromsource.

OK, so at this point I've got the thing built, and the tests passing (legitimately, using the correct version of git-annex-shell). Time to install it.

Issue #5: `sudo make install` doesn't work. stack refuses to run, complaining:

> You are not the owner of '/home/erics/.stack/'. Aborting to protect file permissions. Retry with '--allow-different-user' to disable this precaution.

See https://github.com/commercialhaskell/stack/issues/471 for what this is about.

Three ways to add that option:

1. Hack the Makefile -- add another `if [ $BUILDER = stack ]` section

2. Add this line to git-annex's stack.yaml (or to ~/.stack/config.yaml if you want it as a global setting):

       allow-different-user: true

   (It's a standalone entry, so should have no leading whitespace)

3. For installing, use a variant of the above magic incantation:

   sudo make BUILDER="stack --allow-different-user" GHC="stack ghc --" install

I did #2, but #3 is probably safest, since it means you're only allow(ing)-different-user when you actually need to.

However you do it, be aware that if stack decides, at make-install time, to create any files under the source tree, of course it will create them as root, so subsequent builds as non-root will find them unwritable. I presume that's what stack's error message, "... to protect file permissions", is talking about.

Issue #6: `make install` does indeed cause stack to create more files. Specifically, it builds Build/InstallDesktopFile. It would make sense to build that at `make all` time, so that it gets done as the non-root user. This wouldn't guarantee not to pollute the source tree with root-owned files -- but as it is now, that's pretty much guaranteed to happen.

After all those gripes, one very very good thing: I didn't have to apt-get any Haskell things at all! Stack downloaded everything it needed, including the compiler. Nice!

Questions for @Joey:

A. Is the Makefile undocumented because you don't really intend anyone else to use it, or is that just an oversight?

B. Are any of the above issues legitimate bugs? (Prime candidates, to my mind: #3 and #6)

C. Given all the dependency grief in the comments from Cabal users, and that for all my troubles I experienced none of that ... maybe stack should be the recommended approach, even if you don't use it yourself?

D. What's the preferred way to submit patches? I have a couple of cosmetic ones for Makefile, besides the (trivial) fix for #6

I'll edit the stack section of fromsource (the only part I'm competent to talk about), once I know which direction to go (i.e. the answer to (A)).

Comment by erics — Wed Oct 29 14:05:27 2025
apt-get build-dep git-annex problem on Raspbian

I tried to build git-annex on a current raspbian system. Executing "apt-get build-dep git-annex" I get the following error:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Build-Depends dependency for git-annex cannot be satisfied because the package libghc-yesod-dev cannot be found

Comment by florian-git-annex — Wed Oct 29 14:05:27 2025
comment 64

@stephane-gourichon, Control.Monad.Catch is in the haskell exceptions package, which is a dependency of git-annex. I don't know why it is failing to find it on your system.

You appear to be in some variety of cabal hell; you probably need to delete your ~/.cabal and ~/.ghc and start over.

Also, Debian 7.11 is quite old; to follow the "building from source on Debian" you need Debian unstable, testing, or sometimes stable (doesn't work currently); not oldstable.

Comment by joey — Wed Oct 29 14:05:27 2025
Build on Debian 7.11 AMD64

Hello,

Following https://git-annex.branchable.com/install/fromsource/ "building from source on Debian" succeeds on Xubuntu 16.04 but fails on Debian 7.11. First observed on recent commit `ade6ab4` (the one that was used on Xubuntu 16.04) then failed the same way with most recent commit `f244d94` and for tag `debian/6.20160719-1`.

Haskell context was installed on the machine specifically to build git-annex, so there should not be any extraneous package.

Surprisingly, "make" and "cabal" output rather different messages.

    make

    if [ "cabal" = ./Setup ]; then ghc --make Setup; fi
    if [ "cabal" = stack ]; then \
            cabal build ; \
        else \
            cabal configure --ghc-options=""; \
        fi
    Warning: git-annex.cabal: Ignoring unknown section type: custom-setup
    Resolving dependencies...
    Warning: git-annex.cabal: Ignoring unknown section type: custom-setup

    Utility/Exception.hs:29:18:
        Could not find module `Control.Monad.Catch'
        Perhaps you meant
          Control.Monad.CatchIO (from MonadCatchIO-mtl-0.3.0.4)
          Control.Monad.Base (from transformers-base-0.4.1)
          Control.Monad.Cont (from mtl-2.1.1)
        Use -v to see a list of the files searched for.
    make: *** [Build/SysConfig.hs] Erreur 1

    cabal install

    Warning: git-annex.cabal: Ignoring unknown section type: custom-setup
    Resolving dependencies...
    cabal: Could not resolve dependencies:
    next goal: git-annex (user goal)
    rejecting: git-annex-6.20160923, 6.20160907, 6.20160808 (global constraint
    requires ==6.20160619)
    trying: git-annex-6.20160619
    trying: base-4.5.0.0/installed-40b... (dependency of git-annex-6.20160619)
    trying: git-annex-6.20160619:+concurrentoutput
    next goal: concurrent-output (dependency of
    git-annex-6.20160619:+concurrentoutput)
    rejecting: concurrent-output-1.7.7, 1.7.6, 1.7.5, 1.7.4, 1.7.3, 1.7.2, 1.7.1,
    1.7.0, 1.6.1, 1.6.0 (conflict: base==4.5.0.0/installed-40b...,
    concurrent-output => base(>=4.6))
    rejecting: concurrent-output-1.5.0, 1.4.0, 1.3.0, 1.2.0, 1.1.0, 1.0.1, 1.0.0
    (conflict: git-annex-6.20160619:concurrentoutput => concurrent-output(>=1.6))

Any hint? When succeeding the pair of machines will be my first remote ssh-based repo. I need a recent enough build for mixed content repository that would automatically put some types of files in regular git and some other types in annex. Thanks.

Comment by https://launchpad.net/~stephane-gourichon-lpad — Wed Oct 29 14:05:27 2025
comment 62

In the meantime, the stack.yaml has been updated to use lts-7.0, which includes concurrent-output-1.7.7, so that should solve that.

Comment by joey — Wed Oct 29 14:05:27 2025
concurrent-output-1.7.7
Hi. `concurrent-output-1.7.7` is not present in resolver `lts-5.18`.
Comment by dave — Wed Oct 29 14:05:27 2025
This seems relevant to the comment directly previous this one.
https://git.joeyh.name/?p=concurrent-output.git;a=blobdiff;f=System/Console/Concurrent.hs;h=d8cea13a3816eba44f8d70a855db21e2dd58a27d;hp=124476379264a94e44b51eb1407fd7d80d0348e7;hb=HEAD;hpb=021358c5a033335e05ec9cff72107ab401217c30
Comment by dave — Wed Oct 29 14:05:27 2025
Some errors after the build

    Registering yesod-static-1.1.2.3...
    Installing library in /home/nrb/.cabal/lib/yesod-static-1.1.2.3/ghc-7.4.1
    Registering yesod-static-1.1.2.3...
    cabal: Error: some packages failed to install:
    c2hs-0.16.4 depends on language-c-0.3.2.1 which failed to install.
    dbus-0.10.4 depends on libxml-sax-0.7.4 which failed to install.
    git-annex-4.20130521.2 depends on libxml-sax-0.7.4 which failed to install.
    language-c-0.3.2.1 failed during the configure step. The exception was:
    ExitFailure 1
    libxml-sax-0.7.4 failed during the configure step. The exception was:
    ExitFailure 1
    network-protocol-xmpp-0.4.5 depends on libxml-sax-0.7.4 which failed to
    install.

Comment by https://www.google.com/accounts/o8/id?id=AItOawnaH44G3QbxBAYyDwy0PbvL0ls60XoaR3Y — Wed Oct 29 14:05:27 2025
Build failure

I cloned the `git-annex` repo from github.com and checked out the `6.20160907` tag.

Then I invoked `stack install` and that ended with the following. Note, this is on Windows.

    Configuring concurrent-output-1.7.6...
    Building concurrent-output-1.7.6...
    Preprocessing library concurrent-output-1.7.6...
    [1 of 7] Compiling Utility.Data     ( Utility\Data.hs, .stack-work\dist\2672c1f3\build\Utility\Data.o )
    [2 of 7] Compiling Utility.Exception ( Utility\Exception.hs, .stack-work\dist\2672c1f3\build\Utility\Exception.o )
    [3 of 7] Compiling Utility.Monad    ( Utility\Monad.hs, .stack-work\dist\2672c1f3\build\Utility\Monad.o )
    [4 of 7] Compiling System.Console.Concurrent.Internal ( System\Console\Concurrent\Internal.hs, .stack-work\dist\2672c1f3\build\System\Console\Concurrent\Internal.o )
    [5 of 7] Compiling System.Console.Concurrent ( System\Console\Concurrent.hs, .stack-work\dist\2672c1f3\build\System\Console\Concurrent.o )
    [6 of 7] Compiling System.Console.Regions ( System\Console\Regions.hs, .stack-work\dist\2672c1f3\build\System\Console\Regions.o )

    System\Console\Regions.hs:559:46: Warning:
        Defined but not used: `oldt'

    System\Console\Regions.hs:719:1: Warning:
        Defined but not used: `calcLineUpdate'

    System\Console\Regions.hs:746:1: Warning:
        Defined but not used: `advanceLine'

    System\Console\Regions.hs:773:1: Warning:
        Defined but not used: `isSGR'

    System\Console\Regions.hs:777:1: Warning:
        Defined but not used: `genLineUpdate'

    System\Console\Regions.hs:791:1: Warning:
        Defined but not used: `optimiseLineUpdate'

    System\Console\Regions.hs:807:1: Warning:
        Defined but not used: `combineSGR'

    System\Console\Regions.hs:817:1: Warning:
        Defined but not used: `combineSGRCodes'
    [7 of 7] Compiling System.Process.Concurrent ( System\Process\Concurrent.hs, .stack-work\dist\2672c1f3\build\System\Process\Concurrent.o )

    System\Process\Concurrent.hs:24:49:
        Not in scope: `createProcessConcurrent'

Comment by dave — Wed Oct 29 14:05:27 2025
comment 58
Ok thanks for your answer :)
Comment by reyman64 — Wed Oct 29 14:05:27 2025
problem with latest pull and stack

Is there a tag in github to download the latest dev build (if i want to compile a build with v6 repository for example) ?

Because after a recent `git pull` (commit `65f44423d1b9407a9c0e4a2b2e7e24b701f6dc32` ) on master, i have this error on `stack install` :

Also, `git-annex-shell` is not created by stack install, is it normal ?

    [reyman64@web504 git-annex]$ stack install git-annex --local-bin-path /home/reyman64/bin
    Invalid flag specification:
    - Package 'git-annex' does not define the following flags (specified in stack.yaml):
      feed
      quvi
      tahoe
      webapp-secure
    - Flags defined by package 'git-annex':
      git-annex:android
      git-annex:androidsplice
      git-annex:assistant
      git-annex:benchmark
      git-annex:concurrentoutput
      git-annex:cryptonite
      git-annex:dns
      git-annex:ekg
      git-annex:network-uri
      git-annex:pairing
      git-annex:production
      git-annex:s3
      git-annex:tdfa
      git-annex:testsuite
      git-annex:torrentparser
      git-annex:webapp
      git-annex:webdav

Best, SR.

Comment by reyman64 — Wed Oct 29 14:05:27 2025
comment 57

Check out the tag for the release of git-annex that you want to build to avoid building from master, which may not be ready. In this case, I was adjusting some build flags this morning and hadn't tried a stack build yet.

git-annex-shell is just a symlink to git-annex. I guess that stack install bypasses the code that makes cabal install set up that symlink. You can make the symlink yourself I suppose.

Comment by joey — Wed Oct 29 14:05:27 2025
comment 55

@reyman64, that's a failure to build the feed package, not git-annex. See http://hackage.haskell.org/package/feed for a pointer to its bug tracker.

The best way to avoid running into such problems is to use stack rather than cabal to build git-annex, since that avoids using bleeding-edge and thus frequently broken versions of the dependencies.

Comment by joey — Wed Oct 29 14:05:27 2025
Error on compile

Hi, i have an error with last pulled version on my system :

[17 of 23] Compiling Text.Feed.Constructor ( src/Text/Feed/Constructor.hs, dist/build/Text/Feed/Constructor.o )

src/Text/Feed/Constructor.hs:131:5: Warning: Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: XMLFeed _ [18 of 23] Compiling Text.Feed.Export ( src/Text/Feed/Export.hs, dist/build/Text/Feed/Export.o ) [19 of 23] Compiling Text.Feed.Import ( src/Text/Feed/Import.hs, dist/build/Text/Feed/Import.o ) [20 of 23] Compiling Text.Feed.Util ( src/Text/Feed/Util.hs, dist/build/Text/Feed/Util.o ) [21 of 23] Compiling Text.Feed.Query ( src/Text/Feed/Query.hs, dist/build/Text/Feed/Query.o )

src/Text/Feed/Query.hs:66:53: Module ‘Data.Time.Locale.Compat’ does not export ‘rfc822DateFormat’

src/Text/Feed/Query.hs:66:71: Module ‘Data.Time.Locale.Compat’ does not export ‘iso8601DateFormat’ cabal: Error: some packages failed to install: feed-0.3.11.1 failed during the building phase. The exception was: ExitFailure 1

Comment by reyman64 — Wed Oct 29 14:05:27 2025
comment 53
Great that works now, thanks :)
Comment by reyman64 — Wed Oct 29 14:05:27 2025
comment 52

@reyman64 missing dependency on http-client in that configuration. I've fixed this in git.

Comment by joey — Wed Oct 29 14:05:27 2025
Error with Url.hs

Hi, With minimal compilation for git-annex-5.20151102.1 and Cabal version is : 1.22.4.0 Ghc version is : 7.10.2

I have an error on url.hs:45 binary operator not found before lexical element " ( "

any idea ?

Comment by reyman64 — Wed Oct 29 14:05:27 2025
comment 50

Yes, Debian has a by now very outdated version of git-annex.

You can clone git-annex's git repo and build a debian package from there; it's been updated for these changes.

Comment by joey — Wed Oct 29 14:05:27 2025
Re: Comment 3

At the end of the build I got these errors: Registering yesod-static-1.1.2.3... Installing library in /home/nrb/.cabal/lib/yesod-static-1.1.2.3/ghc-7.4.1 Registering yesod-static-1.1.2.3... cabal: Error: some packages failed to install: c2hs-0.16.4 depends on language-c-0.3.2.1 which failed to install. dbus-0.10.4 depends on libxml-sax-0.7.4 which failed to install. git-annex-4.20130521.2 depends on libxml-sax-0.7.4 which failed to install. language-c-0.3.2.1 failed during the configure step. The exception was: ExitFailure 1 libxml-sax-0.7.4 failed during the configure step. The exception was: ExitFailure 1 network-protocol-xmpp-0.4.5 depends on libxml-sax-0.7.4 which failed to install.

One way I could fix this myself is to put together a VM with 13.10 or Debian in it and work inside that. Or if I can get help to fix my issues here that would be great ;)

Comment by https://www.google.com/accounts/o8/id?id=AItOawnaH44G3QbxBAYyDwy0PbvL0ls60XoaR3Y — Wed Oct 29 14:05:27 2025
Installing debs

@azul - the problem with installing dependencies from apt-get is that the Ubuntu haskell packages are rather old. It shouldn't be this way (and it has gotten a LOT better - I suggest installing the newest version of the Haskell Platform that you can), but often cabal will complain about a package it is unable to install because it failed on the install of that package's dependencies. You should try to cabal install $FAILED_DEPENDENCY (not an actual env variable), and you will often get more informative error messages - some packages require non-haskell dependencies (take gtk3, for instance) which cabal doesn't know how to handle at this point, because that would require some cross platform foo (cabal install runs on Windows and OSX, which don't have native package managers at all).

@Paul - It looks like you ran into a bug, because http-client no longer depends on network>=2.6, it now can take network 2.4 - 2.6 or 2.6 or greater. If you try again it should work.

Please don't be put off by haskell because of things like this - git annex is a very large and complicated project, and developing on large projects such as this pretty much require you to have pretty recent versions of all haskell packages. I really suggest you take a look at this book http://learnyouahaskell.com/introduction. Haskell is a beautiful language and it doesn't have to be esoteric, academic, or difficult at all. It's obvious since you are attempting to build this from source that you are either interested in haskell or you are only interested in the development of git-annex. Either way, it would behoove you to read that book. It is short, full of great examples, and it even has pleasant illustrations. It may look like a children's book, but by the end of it you will know how to use all of the major monads (you may not know what a monad is, but that isn't really that important anyway - you just need to know how they are used).

Comment by https://www.google.com/accounts/o8/id?id=AItOawmfEGTjv4GsWkSG2lpuBitRDxVkml7yEQg — Wed Oct 29 14:05:27 2025
apt-get build-dep fails

    hobbes@namagiri:~/src$ sudo apt-get build-dep git-annex
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Build-Depends dependency for git-annex cannot be satisfied because the package libghc-hamlet-dev cannot be found

Hmm, deprecated in favor of libghc-shakespear-dev, according to http://hackage.haskell.org/package/hamlet ...

    hobbes@namagiri:~/src/apt-get-source-git-annex$ grep -iR build-depends.*hamlet|tr , \\n
    git-annex_5.20141125.dsc:Build-Depends: debhelper (>= 9)
     ghc (>= 7.4)
     cabal-install
     libghc-mtl-dev (>= 2.1.1)
     libghc-missingh-dev
     libghc-data-default-dev
     libghc-hslogger-dev
     libghc-pcre-light-dev
     libghc-sha-dev
     libghc-cryptohash-dev
     libghc-dataenc-dev
     libghc-utf8-string-dev
     libghc-hs3-dev (>= 0.5.6)
     libghc-dav-dev (>= 1.0) [amd64 i386 kfreebsd-amd64 kfreebsd-i386 powerpc]
     libghc-quickcheck2-dev
     libghc-monad-control-dev (>= 0.3)
     libghc-exceptions-dev (>= 0.6)
     libghc-transformers-dev
     libghc-unix-compat-dev
     libghc-dlist-dev
     libghc-uuid-dev
     libghc-json-dev
     libghc-aeson-dev
     libghc-ifelse-dev
     libghc-bloomfilter-dev
     libghc-edit-distance-dev
     libghc-hinotify-dev [linux-any]
     libghc-stm-dev (>= 2.3)
     libghc-dbus-dev (>= 0.10.3) [linux-any]
     libghc-fdo-notify-dev (>= 0.3) [linux-any]
     libghc-yesod-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-yesod-static-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-yesod-default-dev [i386 amd64 kfreebsd-amd64 powerpc]
     libghc-hamlet-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-shakespeare-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-clientsession-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-warp-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-warp-tls-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-wai-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-wai-extra-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc]
     libghc-securemem-dev
     libghc-byteable-dev
     libghc-dns-dev
     libghc-case-insensitive-dev
     libghc-http-types-dev
     libghc-http-conduit-dev
     libghc-blaze-builder-dev
     libghc-crypto-api-dev
     libghc-network-multicast-dev
     libghc-network-info-dev [linux-any kfreebsd-any]
     libghc-safesemaphore-dev
     libghc-network-protocol-xmpp-dev (>= 0.4.3-1+b1)
     libghc-gnutls-dev (>= 0.1.4)
     libghc-xml-types-dev
     libghc-async-dev
     libghc-feed-dev (>= 0.3.9.2)
     libghc-regex-tdfa-dev [!mipsel !s390]
     libghc-regex-compat-dev [mipsel s390]
     libghc-tasty-dev (>= 0.7) [!sparc]
     libghc-tasty-hunit-dev [!sparc]
     libghc-tasty-quickcheck-dev [!sparc]
     libghc-tasty-rerun-dev [!sparc]
     libghc-optparse-applicative-dev [!sparc]
     lsof [!kfreebsd-i386 !kfreebsd-amd64 !hurd-any]
     ikiwiki
     perlmagick
     git (>= 1:2.0)
     rsync
     wget
     curl
     openssh-client
     git-remote-gcrypt (>= 0.20130908-6)
     llvm-3.4 [armel armhf]

I think that's the bug, right there: git-annex_5.20141125.dsc.

I hope this helps.

Comment by dave — Wed Oct 29 14:05:27 2025
where to start reading the source code

@thnetos, great question!

Annex.hs is a key starting place, as it defines git-annex's main monad. If you like learning code bases bottom-up, Types/* has files for the main data types used in git-annex, such as Key and UUID and Remote and GitConfig.

Command/ gets you the implementation of any particular git-annex command you are interested in. Or Remote/ for any particular special remote.

I recommend running "make tags" and then your editor should be able to use the tags file to bounce around in the source code.

Comment by joey — Wed Oct 29 14:05:27 2025
Where to start reading the source code?
Do you have any recommendations for the overall haskell architecture of the project? Where to start looking if I want to read through the source code?
Comment by thnetos — Wed Oct 29 14:05:27 2025
comment 46

Britt's comment is spot on, but git-annex tries pretty hard to work with lots of older versions of haskell libraries, as well as the latest and greatest. So it should be ok to install haskell libraries with apt-get and use them to build git-annex, as the (revised) instructions above show.

What tends not to work so well is use apt-get to install older versions of haskell libraries and then cabal install on top to add newer stuff. Gets complicated and I'd recommend not going there. The instructions above show using either apt-get or cabal to install the haskell libraries, but not both.

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
no need for c2hs
The c2hs mentioned in some of the above comments is not needed any longer; ghc 7.6.3 and newer come with a hsc2hs command that is used.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
comment 4

@azul, thanks for hints, but it still fails. No wonders though - this is Haskell, kids.

    $ cabal install git-annex --only-dependencies
    Resolving dependencies...
    cabal: Could not resolve dependencies:
    trying: git-annex-5.20140817
    trying: git-annex-5.20140817:+webapp
    trying: git-annex-5.20140817:+s3
    trying: git-annex-5.20140817:+dns
    trying: dns-1.4.3
    trying: yesod-1.2.6.1
    trying: yesod-auth-1.3.4.2
    trying: http-client-0.3.7.1
    trying: http-client-0.3.7.1:+network-uri
    trying: hS3-0.5.8
    trying: hxt-9.3.1.6
    trying: hxt-9.3.1.6:-network-uri
    rejecting: network-2.6.0.1, 2.6.0.0 (conflict: hxt-9.3.1.6:network-uri =>
    network>=2.4 && <2.6)
    rejecting: network-2.5.0.0, 2.4.2.3, 2.4.2.2, 2.4.2.1, 2.4.2.0, 2.4.1.2,
    2.4.1.1, 2.4.1.0, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.1, 2.3.1.0, 2.3.0.14,
    2.3.0.13, 2.3.0.12, 2.3.0.11, 2.3.0.10, 2.3.0.9, 2.3.0.8, 2.3.0.7, 2.3.0.6,
    2.3.0.5, 2.3.0.4, 2.3.0.3, 2.3.0.2, 2.3.0.1, 2.3 (conflict:
    http-client-0.3.7.1:network-uri => network>=2.6)
    rejecting: network-2.2.3.1, 2.2.3, 2.2.1.10, 2.2.1.9, 2.2.1.8, 2.2.1.7,
    2.2.1.6, 2.2.1.5, 2.2.1.4, 2.2.1.3, 2.2.1.2, 2.2.1.1, 2.2.1, 2.2.0.1, 2.2.0.0,
    2.1.0.0, 2.0 (conflict: dns => network>=2.3)

Comment by https://www.google.com/accounts/o8/id?id=AItOawld54zdyk6b0W4jXnssSO_j2Nn3W1uVsUE — Wed Oct 29 14:05:27 2025
Re: Comment 3

@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.

Comment by https://www.google.com/accounts/o8/id?id=AItOawnaH44G3QbxBAYyDwy0PbvL0ls60XoaR3Y — Wed Oct 29 14:05:27 2025
GHC 7.8 Issue

Just an FYI: I tried to "cabal install --only-dependencies" with GHC 7.8 and it fails because DAV-1.0.1 is pulling in lens-3.10.3 which is not compatible with GHC 7.8 due to changes in Typeable.

I don't have enough experience with cabal to figure out why it's not trying to use a newer version of lens.

Comment by https://www.google.com/accounts/o8/id?id=AItOawkftzaCvV7EDKVDfJhsQZ3E1Vn-0db516w — Wed Oct 29 14:05:27 2025
comment 38

@Daniel, I suggest you either follow the instuctions above, or if you don't want to follow the instructions, follow the error messages. :P In this case, the instructions say to do:

> PATH=$HOME/bin:$PATH cabal install c2hs --bindir=$HOME/bin

Which is exactly to work around the problem that we can see in your transcript: `Installing executable(s) in /root/.cabal/bin`

Also, to reiterate the top of the page: 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!

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Install fails horribly

    lyriondesktop:/home/zilti/tmp # cabal install c2hs
    Resolving dependencies...
    Configuring c2hs-0.17.2...
    Building c2hs-0.17.2...
    Preprocessing executable 'c2hs' for c2hs-0.17.2...
    [ 1 of 26] Compiling Data.DLists      ( src/Data/DLists.hs, dist/build/c2hs/c2hs-tmp/Data/DLists.o )
    [ 2 of 26] Compiling Control.StateTrans ( src/Control/StateTrans.hs, dist/build/c2hs/c2hs-tmp/Control/StateTrans.o )

    src/Control/StateTrans.hs:77:1: Warning:
        Module `Prelude' does not export `catch'
    [ 3 of 26] Compiling Data.Errors      ( src/Data/Errors.hs, dist/build/c2hs/c2hs-tmp/Data/Errors.o )
    [ 4 of 26] Compiling Data.Attributes  ( src/Data/Attributes.hs, dist/build/c2hs/c2hs-tmp/Data/Attributes.o )
    [ 5 of 26] Compiling Text.Lexers      ( src/Text/Lexers.hs, dist/build/c2hs/c2hs-tmp/Text/Lexers.o )
    [ 6 of 26] Compiling Control.StateBase ( src/Control/StateBase.hs, dist/build/c2hs/c2hs-tmp/Control/StateBase.o )
    [ 7 of 26] Compiling Data.NameSpaces  ( src/Data/NameSpaces.hs, dist/build/c2hs/c2hs-tmp/Data/NameSpaces.o )
    [ 8 of 26] Compiling C2HS.C.Attrs     ( src/C2HS/C/Attrs.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Attrs.o )
    [ 9 of 26] Compiling C2HS.C.Builtin   ( src/C2HS/C/Builtin.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Builtin.o )
    [10 of 26] Compiling Paths_c2hs       ( dist/build/autogen/Paths_c2hs.hs, dist/build/c2hs/c2hs-tmp/Paths_c2hs.o )
    [11 of 26] Compiling C2HS.Config      ( src/C2HS/Config.hs, dist/build/c2hs/c2hs-tmp/C2HS/Config.o )
    [12 of 26] Compiling C2HS.Switches    ( src/C2HS/Switches.hs, dist/build/c2hs/c2hs-tmp/C2HS/Switches.o )
    [13 of 26] Compiling C2HS.Version     ( src/C2HS/Version.hs, dist/build/c2hs/c2hs-tmp/C2HS/Version.o )
    [14 of 26] Compiling System.CIO       ( src/System/CIO.hs, dist/build/c2hs/c2hs-tmp/System/CIO.o )
    [15 of 26] Compiling Control.State    ( src/Control/State.hs, dist/build/c2hs/c2hs-tmp/Control/State.o )
    [16 of 26] Compiling C2HS.State       ( src/C2HS/State.hs, dist/build/c2hs/c2hs-tmp/C2HS/State.o )
    [17 of 26] Compiling C2HS.CHS.Lexer   ( src/C2HS/CHS/Lexer.hs, dist/build/c2hs/c2hs-tmp/C2HS/CHS/Lexer.o )

    src/C2HS/CHS/Lexer.hs:612:16: Warning:
        Defined but not used: `lexeme'
    [18 of 26] Compiling C2HS.CHS         ( src/C2HS/CHS.hs, dist/build/c2hs/c2hs-tmp/C2HS/CHS.o )
    [19 of 26] Compiling C2HS.Gen.Header  ( src/C2HS/Gen/Header.hs, dist/build/c2hs/c2hs-tmp/C2HS/Gen/Header.o )
    [20 of 26] Compiling C2HS.C.Trav      ( src/C2HS/C/Trav.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Trav.o )
    [21 of 26] Compiling C2HS.C.Names     ( src/C2HS/C/Names.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Names.o )
    [22 of 26] Compiling C2HS.C           ( src/C2HS/C.hs, dist/build/c2hs/c2hs-tmp/C2HS/C.o )
    [23 of 26] Compiling C2HS.Gen.Monad   ( src/C2HS/Gen/Monad.hs, dist/build/c2hs/c2hs-tmp/C2HS/Gen/Monad.o )

    src/C2HS/Gen/Monad.hs:227:10: Warning:
        Orphan instance: instance Read Ident
    [24 of 26] Compiling C2HS.C.Info      ( src/C2HS/C/Info.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Info.o )
    [25 of 26] Compiling C2HS.Gen.Bind    ( src/C2HS/Gen/Bind.hs, dist/build/c2hs/c2hs-tmp/C2HS/Gen/Bind.o )

    src/C2HS/Gen/Bind.hs:971:43: Warning:
        In the use of `posColumn' (imported from Language.C.Data.Position):
        Deprecated: "column number information is inaccurate in presence of macros - do not rely on it."

    src/C2HS/Gen/Bind.hs:789:10: Warning:
        Orphan instance: instance Num CInteger
    [26 of 26] Compiling Main             ( src/Main.hs, dist/build/c2hs/c2hs-tmp/Main.o )
    Linking dist/build/c2hs/c2hs ...
    Installing executable(s) in /root/.cabal/bin
    Installed c2hs-0.17.2
    lyriondesktop:/home/zilti/tmp # cabal install git-annex
    Resolving dependencies...
    Configuring gnuidn-0.2.1...
    cabal: The program c2hs is required but it could not be found.
    Failed to install gnuidn-0.2.1
    cabal: Error: some packages failed to install:
    git-annex-5.20140709 depends on gnuidn-0.2.1 which failed to install.
    gnuidn-0.2.1 failed during the configure step. The exception was:
    ExitFailure 1
    network-protocol-xmpp-0.4.6 depends on gnuidn-0.2.1 which failed to install.

Comment by https://www.google.com/accounts/o8/id?id=AItOawmveNWaFIL1zEehHr_0416bKBzsul5tGlE — Wed Oct 29 14:05:27 2025
I did indeed get problems on Ubuntu 13.04

The issues I had were version mismatches when resolving dependencies of git-annex.

It seems that when you install haskell-platform package with apt-get, it installs a bunch of haskell dependencies as apt packages, yet those aren't needed for any other system packages. So some people here who complain about version mismatches might not have intended to install any Haskell libraries with apt, they just come along for the ride by default.

I can't remember the exact ones, but I ended up uninstalling some of the stuff that gets auto-installed along with haskell-platform, and using cabal to build those. Then all the git-annex dependencies worked.

Why 13.04 in this day and age? Using Zentyal as a home server/gateway, and it currently runs on 13.04.

This method might not work if you installed other apt packages that do need those apt-based Haskell libraries. But if git-annex is all you need that uses the Haskell platform, might work.

Comment by https://www.google.com/accounts/o8/id?id=AItOawkNcHu5T1Pxzl-r2co9vf6SxXYWubv2P04 — Wed Oct 29 14:05:27 2025
comment 35
The `errMessage` build failure is due to a new version of optparse-applicative. I've added support for it in git master.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Re: Build failure
I get exactly the same error message as Matthias when attempting the minimal Cabal install on openSUSE 12.2 (x86_64) Linux.
Comment by https://openid.stackexchange.com/user/a05bb829-932b-49f2-85a9-00dcda8b5e20 — Wed Oct 29 14:05:27 2025
Build failure

I followed the instructions and the invocation of

    cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"

resulted in the following error:

    Test.hs:107:41: Not in scope: `errMessage'
    Failed to install git-annex-5.20140306
    cabal: Error: some packages failed to install:
    git-annex-5.20140306 failed during the building phase. The exception was:
    ExitFailure 1

I used the Haskell Platform for Mac OS X (10.8)

Comment by https://www.google.com/accounts/o8/id?id=AItOawn3p4i4lk_zMilvjnJ9sS6g2nerpgz0Fjc — Wed Oct 29 14:05:27 2025
comment 32

@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..

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
a different error trying to build from the git repo....

I'm using the ghc7.0 branch because Fink's GHC is still at 7.0.4....

    $ cabal build
    Building git-annex-3.20120523...
    Preprocessing executable 'git-annex' for git-annex-3.20120523...
    [ 78 of 163] Compiling Utility.Url      ( Utility/Url.hs, dist/build/git-annex/git-annex-tmp/Utility/Url.o )

    Utility/Url.hs:111:88:
        Couldn't match expected type `Maybe URI' with actual type `URI'
        In the second argument of `fromMaybe', namely
          `(newURI `relativeTo` u)'
        In the expression: fromMaybe newURI (newURI `relativeTo` u)
        In an equation for `newURI_abs':
            newURI_abs = fromMaybe newURI (newURI `relativeTo` u)

Comment by robohack — Wed Oct 29 14:05:27 2025
hmmm... ok, the PCRE problem was odd, but now this:

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:

    $ cabal install git-annex --bindir=$HOME/bin --extra-include-dirs=/sw/include --extra-lib-dirs=/sw/lib
    Resolving dependencies...
    [1 of 1] Compiling Main             ( /var/folders/7h/7hWHR5m8HPKOnUEvQU7HU++++TI/-Tmp-/git-annex-3.20120230-84797/git-annex-3.20120230/Setup.hs, /var/folders/7h/7hWHR5m8HPKOnUEvQU7HU++++TI/-Tmp-/git-annex-3.20120230-84797/git-annex-3.20120230/dist/setup/Main.o )
    Linking /var/folders/7h/7hWHR5m8HPKOnUEvQU7HU++++TI/-Tmp-/git-annex-3.20120230-84797/git-annex-3.20120230/dist/setup/setup ...
    hsc2hs Utility/StatFS.hsc
    perl -i -pe 's/^{-# INCLUDE.*//' Utility/StatFS.hs
    ghc -O2 -Wall -ignore-package monads-fd --make configure

    Utility/StatFS.hsc:54:8:
        Could not find module `GHC.Foreign':
          Use -v to see a list of the files searched for.
    make: *** [Build/SysConfig.hs] Error 1
    Configuring git-annex-3.20120230...
    Building git-annex-3.20120230...
    Preprocessing executable 'git-annex' for git-annex-3.20120230...

    Git/Version.hs:11:18:
        Could not find module `Build.SysConfig':
          Use -v to see a list of the files searched for.
    Failed to install git-annex-3.20120230
    cabal: Error: some packages failed to install:
    git-annex-3.20120230 failed during the building phase. The exception was:
    ExitFailure 1

Comment by robohack — Wed Oct 29 14:05:27 2025
c2hs required for cabal to install dependencies

Next thing i ran into was missing c2hs. So `apt-get install c2hs` before running the cabal install otherwise...

    $ cabal install git-annex --only-dependencies
    Resolving dependencies...
    Configuring gnuidn-0.2.1...
    cabal: The program c2hs is required but it could not be found.
    Failed to install gnuidn-0.2.1
    cabal: Error: some packages failed to install:
    gnuidn-0.2.1 failed during the configure step. The exception was:
    ExitFailure 1
    network-protocol-xmpp-0.4.6 depends on gnuidn-0.2.1 which failed to install.

Comment by azul — Wed Oct 29 14:05:27 2025
comment 3

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.

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
cabal install failing due to problems building pcre-light-0.4

After a fresh install of Haskell, and following the instructions above, I end up with the following rather bizarre and unexpected problem:

    $ cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"
    Resolving dependencies...
    Configuring pcre-light-0.4...
    Building pcre-light-0.4...
    Preprocessing library pcre-light-0.4...
    Base.hsc:103:18: error: pcre.h: No such file or directory
    Base.hsc: In function ‘main’:
    Base.hsc:402: error: ‘PCRE_ANCHORED’ undeclared (first use in this function)
    Base.hsc:402: error: (Each undeclared identifier is reported only once
    Base.hsc:402: error: for each function it appears in.)
    Base.hsc:405: error: ‘PCRE_AUTO_CALLOUT’ undeclared (first use in this function)

(followed by an error for every other macro that was expected to be defined in the header...)

    compiling dist/build/Text/Regex/PCRE/Light/Base_hsc_make.c failed (exit code 1)
    command was: /usr/bin/gcc -c dist/build/Text/Regex/PCRE/Light/Base_hsc_make.c -o dist/build/Text/Regex/PCRE/Light/Base_hsc_make.o -m64 -fno-stack-protector -m64 -fno-stack-protector -m64 -D__GLASGOW_HASKELL__=700 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS -Dx86_64_BUILD_ARCH -Dx86_64_HOST_ARCH -I/sw/lib/ghc-7.0.4/bytestring-0.9.1.10/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/sw/lib/ghc-7.0.4/base-4.3.1.0/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/sw/lib/ghc-7.0.4/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/sw/lib/ghc-7.0.4/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/sw/lib/ghc-7.0.4/include/
    Failed to install pcre-light-0.4
    cabal: Error: some packages failed to install:
    git-annex-3.20120230 depends on pcre-light-0.4 which failed to install.
    pcre-light-0.4 failed during the building phase. The exception was:
    ExitFailure 1

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.)

Comment by robohack — Wed Oct 29 14:05:27 2025
comment 28

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.)

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
comment 27

Okay, the error doesn't show up anymore. I didn't even get to Cronner though, because this time I got a different error:

    Assistant/Alert.hs:195:20:
        Couldn't match expected type `Assistant ()' with actual type `()'
        Expected type: Maybe Remote -> Assistant ()
          Actual type: Maybe Remote -> ()
        In the expression: noop
        In an equation for `notFsckedNudge': notFsckedNudge _ = noop

This is from trying to compile 4.20131101 with `-f"-webapp -webdav"`

Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 26
@RaspberryPie that only affected builds without the webapp, in any case it's fixed now.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Bad version on Hackage
Quick note: The latest version in the Hackage repository (git-annex-4.20131024) fails to build, due to a faulty version of Assistant/Threads/Cronner.hs.
Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 24
I fixed the error by installing a newer version of cryptohash. Thanks for pointing out the culprit.
Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 23
git-annex needs cryptohash version 0.10.0 or greater. You appear to have an old version. You can cabal `configure -f-CryptoHash` if it's for some reason failing to disable the cryptohash support despite the declared dependency not being met.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
"Could not find module Crypto.Hash" error when building git-annex

Lately I get this error message when trying to build git-annex-v4.20131002:

    Utility/Hash.hs:7:8:
        Could not find module `Crypto.Hash'
        Perhaps you meant
          Crypto.HMAC (needs flag -package crypto-api-0.10.2)
        Use -v to see a list of the files searched for.

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.

Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 21
If you run the "cabal update" command followed by the "cabal install" command it'll upgrade git-annex.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Updating git-annex via cabal
What is the best way to update git-annex and the dependencies via cabal? Just the `$ cabal install *` commands again?
Comment by https://www.google.com/accounts/o8/id?id=AItOawlkA6XinbeOdnEDxEGQUWyjqPGh0kdMXr4 — Wed Oct 29 14:05:27 2025
conflict solved

`apt-get install happy alex libghc-hjsmin-dev` solved the problem for me. The hjsmin lib was probably crucial. It seems a bunch of dependencies can also be installed as debs rather than through cabal. `standalone/android/buildchroot-inchroot` gave me a clue.

Comment by azul — Wed Oct 29 14:05:27 2025
E: Unable to locate package libghc-libxml-sax-dev

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

Comment by https://www.google.com/accounts/o8/id?id=AItOawnaH44G3QbxBAYyDwy0PbvL0ls60XoaR3Y — Wed Oct 29 14:05:27 2025
Cabal installing git-annex on Ubuntu 12.04 Precise with GHC 7.6.3

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.

1. Apt install non-cabal dependencies:

       sudo aptitude install c2hs libgsasl7-dev libxml2-dev

2. Manually cabal install yesod-platform to avoid the cryptocipher problem mentioned above:

       cabal install yesod-platform

3. Cabal install git-annex with DNS flag disabled:

       cabal install git-annex -f"-dns"

I was getting this error building git-annex before disabling the DNS flag:

    Utility/SRV.hs:70:54:
        Couldn't match expected type `Maybe
                                        [(Int, Int, Integer, B8.ByteString)]'
                    with actual type `Either
                                        dns-1.0.0:Network.DNS.Internal.DNSError
                                        [(Int, Int, Int, dns-1.0.0:Network.DNS.Internal.Domain)]'
        In the third argument of `maybe', namely `r'
        In the second argument of `($)', namely
          `maybe [] (orderHosts . map tohosts) r'
        In a stmt of a 'do' block:
          return $ maybe [] (orderHosts . map tohosts) r

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.

Comment by https://www.google.com/accounts/o8/id?id=AItOawlu7K3h7Ry1uDAU_ERYGuqt0LoGNJqGuRo — Wed Oct 29 14:05:27 2025
git-annex assistant for the Raspberry Pi

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

Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 17

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.

Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
comment 16

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

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
git-annex assistant on Arm
I'd like to use the assistant's power on a Raspberry Pi to build an always-on file/sync server. Is there a way to get the assistant running on Arm? I know there's a Debian package, but it's Version 3.20120629 and comes without the assistant. Has anyone ever successfully built a recent git-annex version on Arm? What would I need in order to do it myself?
Comment by RaspberryPie — Wed Oct 29 14:05:27 2025
Problems with cryptocipher

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.

Comment by https://www.google.com/accounts/o8/id?id=AItOawlfIVXjkzrYE9qJAO2A0H7K6tKGMaSgc3U — Wed Oct 29 14:05:27 2025
TonidoPlug
@Joey Thanks for the answer. I didn't want to mess around too much with the TonidoPlug. I am currently setting up a raspberry pi, which works fine.
Comment by https://www.google.com/accounts/o8/id?id=AItOawlXEIT2PEAuHuInLP4UYVzWE0lceMYd2lA — Wed Oct 29 14:05:27 2025
comment 12

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.

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Installation on tonidoplug

I tried various ways to install git-annex on my TonidoPlug.

System Info:

    root@TonidoPlug2:~# uname -a
    Linux TonidoPlug2 2.6.31.8-topkick1281p2-001-004-20101214 #1 Thu Jun 16 10:06:20 CST 2011 armv5tel GNU/Linux

`apt-get` didn't work.

    root@TonidoPlug2:~# apt-get install git-annex
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package git-annex

The Linux standalone installation results in an error message like this, when calling `git-annex` (or `git annex`)

    ~$ git-annex.linux/git-annex
    /home/gitolite/git-annex.linux/bin/git-annex: 1: Syntax error: ")" unexpected

(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)

    ~$ cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"
    Resolving dependencies...
    cabal: cannot configure git-annex-4.20130802. It requires base >=4.5 && <4.8
    For the dependency on base >=4.5 && <4.8 there are these packages:
    base-4.5.0.0, base-4.5.1.0, base-4.6.0.0 and base-4.6.0.1. However none of
    them are available.
    base-4.5.0.0 was excluded because of the top level dependency base -any
    base-4.5.1.0 was excluded because of the top level dependency base -any
    base-4.6.0.0 was excluded because of the top level dependency base -any
    base-4.6.0.1 was excluded because of the top level dependency base -any

Any help is appreciated. Thanks for providing git-annex. I started cleaning up my backups with it yesterday and really like it.

Comment by https://www.google.com/accounts/o8/id?id=AItOawlXEIT2PEAuHuInLP4UYVzWE0lceMYd2lA — Wed Oct 29 14:05:27 2025
comment 10
@Henning; see the OSX page for full installation instructions for OSX. Which include all the neccesary brew incantations.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Cabal dependencies

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.

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 12.04.2 LTS
    Release:    12.04
    Codename:   precise

    $ apt-get install cabal-install libgnutls28-dev libgsasl7-dev c2hs libghc-libxml-sax-dev zlib1g-dev libghc-zlib-dev
    $ cabal install git-annex --bindir=$HOME/bin

Comment by https://www.google.com/accounts/o8/id?id=AItOawlJemqsekZTC5dvc-MAByUWaBvsYE-mFUo — Wed Oct 29 14:05:27 2025
cabal fails to resolve dependencies

I tried this on ubuntu 14.04 without any previous haskell installs and cabal failed to resolve the dependencies:

rejecting: optparse-applicative-0.9.0 (conflict: hjsmin => optparse-applicative>=0.7 && <0.9)

full log

Comment by azul — Wed Oct 29 14:05:27 2025
Comments on this page are closed.