-
Notifications
You must be signed in to change notification settings - Fork 0
Build instructions for Cygwin
It is actually not very hard to get ledger built under Cygwin (a Unix-like environment that runs under Microsoft Windows.) For the most part, the process is as simple as cloning ledger, installing dependent packages, running CMake to generate build files, and then using the ledger acprep utility to build and install ledger.
These notes were prepared in June 2013, when Ledger was at version 3.0 20130529.
Using the Cygwin setup program, install the following packages, if they are not already installed:
- git
- gcc
- cmake
- libboost1.53 (or later)
- gmp
- mpfr
- gettext
- libedit
- python
- doxygen
- texinfo
There are no stock packages for graphvis, lcov, or sloccount in the Cygwin package archive, but these are optional dependencies for Ledger. It will build fine without them.
I recall that I had trouble getting CMake to find Boost even after it was installed by Cygwin. If I remember correctly, I also had to check the "Install source" option for the Boost libraries. This makes a little bit of sense, since the Boost libraries consist mainly of source header files.
I also had trouble getting CMake to find gmp and mpfr until I also installed the gmp-devel package. I don't think this should have been necessary, your mileage may vary.
This is as easy as
git clone https://github.com/ledger/ledger.git
Don't start right away using the acprep utility. Instead, explicitly create Unix-style makefiles using the following command from the top-level of your ledger source tree:
cmake -G "Unix Makefiles"
This is when you will find out if you have all of the dependent libraries installed. This is the most difficult part of the process. CMake can be finicky. I'm no expert -- I just kept going back to Cygwin setup, installing likely-sounding packages, and repeating the CMake step until it announced success.
I think I have something that has recently gone wrong with my Cygwin installation. When scripts create new directories, it creates them with 000 permissions, and then the scripts fail when they need to populate those directories. I doubt this will happen to you. If it does, my naive solution has been to re-run the Cygwin shell as administrator.
Then you run
./acprep update
If you have a processor with multiple cores, you might want to pass a -jX option, where X is the number of cores you want it to use for compiling. You don't get to see 100% CPU utilization very often -- here's your chance.
If all went well, the result will be a file named ledger.exe at the top of your source tree.
Finally, you can install ledger to the standard location by running
make install
This will put ledger in /usr/local/bin/ledger.
On two occasions when I built Ledger under Cygwin, I encountered a "process fork error". See http://cygwin.wikia.com/wiki/Rebaseall. The solution is to do a "rebase all" as described in that article.
If you have the Windows version of CMake installed, the Cygwin CMake may get confused even if the Windows CMake is not on your path! In the middle of running your Cygwin CMake, Windows-style pathnames will start appearing, or CMake will be unable to find things that you are sure are there. To get this to work, I had to temporarily rename my Windows cmake.exe to something else to get it out of the way.
When I repeated this process a few months later, I did not have this problem.
If you get a segfault with the error "Exception during initialization: locale::facet::_S_create_locale name not valid", try setting the LAGN environment variable to "", i.e.:
export LANG=""
I added this to my .profile.
If that language setting does not accurately reflect your actual language, I don't know what the "right" solution is.