I've just had a crack at building ledger from githib (commit d0c47...)
on Cygwin and thought I'd share my findings, in case anyone else is
contemplating doing the same.
Firstly v2.6.2 builds and runs just fine once you've installed the
dependencies, and passes 'make check' right away, so I'd recommend
using that if you're not interested in the bleeding edge.
For a more recent commit, Cygwin has almost all of the dependencies as
packages, so I won't detail those requirements here (remember to get
the -devel versions of the packages). Cygwin doesn't have a recent
boost package, so you'll need to download and build that. This takes a
while.
Kick off 'acprep'. If it complains about versions of gettext, you'll
need to manually specify the gettext version (because autopoint can't
properly parse the version number of the gettext library): I used the
command 'autopoint -V 0.17'. You'll need cvs installed for this.
Most likely you'll need to tell configure where to find your boost
installation. Here's the command I used:
$ CPPFLAGS=-I/usr/include/boost-1_39 LDFLAGS=-L/usr/lib/engines ./
configure --with-boost-suffix=-gcc34-mt --prefix=/usr
(here /usr/lib/engines is specified as that is where Cygwin placed my
libgmp.so)
The first time I ran this, it didn't drop a Makefile in the po/
directory. I cleaned out the folder, reran autopoint as above, and
tried again, and this time a Makefile was created.
Now run 'make'. This will take a while too. If you've downloaded your
repository from github (instead of cloning it with git), you'll also
need to get the 'utfcpp' project and place it in the 'lib' folder--it
isn't automatically included by the github download mechanism.
I had to fix a couple of errors in src/filters.cc during the build,
namely casting the argument supplied to SHA1::Result by changing lines
169 and 192 to: sha.Result((unsigned int*)message_digest);
After the build, you'll get a honking 167MB executable. Wondering why
the resulting file is such a monster, I took a look at some of the
object files that are linked together: a lot of them are around the
15MB mark. Mind you, v2.6.2 weighs in at a svelte 6.5MB, so I'm
assuming either a lot of functionality was added between the two
versions, or more likely the switch to Boost has saddled a lot of
template overhead that the aged and infirm gcc that Cygwin supplies
(3.4.4) does not optimise.
Now for the tests: 'make check' was broken for me as the makefile
wanted to add '.exe' to the end of the targets (RegressTests,
BaselineTests, etc) and couldn't find them. I modified the makefile,
but this still didn't get a functioning test harness working. The
RegressTests.py script kept adding a temporary filename as the ledger
file to the command to execute which would then crap out the tests
because the file didn't exist. Presumably this is because the test
harness is being worked on right now and the commands need to be
updated (ie. by putting '-f - ' in the command field in each test
file). I brutally hacked this out of the RegressTests.py script,
removing all lines between: 'if test['command'].find("-f - ") != -1:'
and ' p = harness.run(test['command'],' replacing them with:
test['command'] = '$ledger -f - ' + test['command']
use_stdin = True
tempdata = tempfile.mkstemp()
If my Python were any good, I'd probably patch in a more elegant
solution. Meh, so it goes. Here's what I now get from 'make check-
TESTS':
OK (19) FAILED (2)
FAIL: RegressTests
..............................[snip]
OK (134) FAILED (4)
FAIL: BaselineTests
.......
OK (7)
PASS: ConfirmTests
...................
OK (19)
PASS: GenerateTests
One of the failed tests has already been reported here:
http://groups.google.com/group/ledger-cli/browse_thread/thread/93e9d7c9582dcb40
so no need to worry about that, the remaining failures look like a
date bug possibly related to the issue in the post above, or
peculiarities relating to my hacked-up bludgeoning of the test
harness.
All in all, it seems to work OK, even if the executable is a little on
the heavy side. Maybe building with a more recent gcc brings it back
under control. Can anyone confirm this? Not that it would matter, you
take what you're given with Cygwin and you're grateful for it.
Thanks, I'm looking forward to using my tubby new ledger now!
Simon.