Windows

From GnuCash
Revision as of 12:48, 18 December 2006 by Hfelton (talk | contribs) (no code for module (srfi srfi-39))
Jump to: navigation, search

GnuCash on Microsoft Windows

This page collects various notes about compiling GnuCash on Microsoft Windows. See Windows/Old_Notes for old, solved issues.

Q: Is it possible to compile GnuCash on Windows?

A: Well, compiling is possible, and running as well, but so far not everything runs.

Q: So, where is the binary?

We do not (yet) provide a binary for Windows. The simple reason is already stated above: We know compiling is possible, but the runtime testing has just started, and we expect a lot of issues still need to be resolved. This means the source code will change quite quickly and those early testers are expected to follow those source code changes by getting the code from SVN. On the other hand, providing a binary would mean people wouldn't follow the source code changes quickly enough, making the testing almost useless. (That would change if someone volunteers to provide e.g. a nightly binary build. Volunteers, anyone?) That's why we still do not provide a binary, until we've received enough positive feedback to know the program can actually be distributed.

Instructions for an (almost) automated build

Copied from http://lists.gnucash.org/pipermail/gnucash-devel/2006-September/018588.html

Several people have now compiled and run GnuCash on MS Windows by the mingw32/gcc compiler environment. These instructions explain how everyone else can give it a try as well. We would be happy to hear any further feedback about problems or (hopefully) success in this matter.

We've created a shell script that will download, compile, and install all requirements of GnuCash on Windows and eventually GnuCash itself. It will even make sure to retrieve the most up-to-date gnucash source code directly from SVN. Running this script will probably download ~200MB of data (but all downloaded data will be cached) and will take anything between 0.5 through 5 hours of time. That shell script is located in packaging/win32/install.sh of the gnucash SVN sources.

Before you can execute this shell script (which will do everything else automatically), you have to complete these steps manually:

  • Get the contents of the packaging/win32/ directory of gnucash SVN, most up-to-date from SVN, and copy it to some directory on your Windows machine. Do not use a directory that is one of the parent directories of the path you intend to use for the repository in the next step (c:\soft\repos by default). Possible locations are c:\soft\packaging or c:\soft\downloads.
  • Adapt the directory name variables in the custom.sh file according to your preferences; the defaults would install everything in subdirectories below c:\soft. (Note that due to shell syntax, every windows-style backslash has to be specified as two backslashes.)
  • Execute this downloaded package to install it into the chosen directory, say, C:\soft\msys (which is the $MSYS_DIR variable in custom.sh)
  • Start the MSYS commandline shell by double-clicking the "MSYS" icon on the desktop which should have been created when you installed the MSYS package.
  • Let the automated build begin by typing:
 $INSTALLER_DIR/install.sh   (the complete path to the install.sh)
  • Some of the downloaded packages are installed through graphical installer dialogs where you can choose an installation directory. In those cases, the install.sh script will tell you in the MSYS window the installation directory that you should choose, according to your settings in custom.sh. Please enter only those installation directory in the installer dialog because otherwise the install.sh script cannot find the newly installed software.
  • If there haven't been any errors, you should be able (after several hours of compiling and installing) to start gnucash from the MSYS command line by typing
 c:/soft/gnucash/bin/gnucash

or even without MSYS directly by "Start"-> "Run"-> "c:\soft\gnucash\bin\gnucash.bat"

Please spread the word and report back any problems you encounter. It is probably not too difficult anymore to create a full self-contained package of GnuCash on Windows as well! Some more information is also collected here on this wiki page.

A bit of history

This page used to collect random notes from the time when we manually tried to install each and every part of the requirements. They have been moved to Windows/Old Notes.

Notes

gdb

In addition to Stack Trace, here are a few instructions on how to run gnucash under gdb on Windows:

  • Install "gdb" from mingw.org
  • Modify the installed "gnucash" script to call "exec gdb gnucash-bin.exe" instead of "exec gnucash-bin.exe" at the end
  • Then start gnucash, which will give you the gdb prompt
  • Type "run" at the gdb prompt.
  • Then provoke the crash and type "backtrace" or shorthand "bt" at the gdb prompt to obtain the backtrace, as explained on Stack Trace as well.

You can provide even better stack traces if you tell gdb where in memory dynamically loaded modules got mapped to, because otherwise function calls into those are only written as '??'. See here and here for a way to do this.

install.sh

  • To debug install.sh, change set -e to set -ex at the top of it.
  • Once you have installed Subversion, you might want to checkout and update packaging/win32 as described in SVN.
svn checkout http://svn.gnucash.org/repo/gnucash/trunk/packaging/win32 packaging

Problems, issues, comments

For any problem that occurs now, you should add a new section below.

pkg-config

Error: Endless loop with "The application failed to initialize properly (0xc0000142)." problem is in install.sh (rev.15222 lines 541,546) the pkg_config here-file should not use the $(PKG_CONFIG) variable since it creates a self-referential-script.

Indeed, r15215 (r12155 is irrelevant here) introduced a regression, because the pkg-config-msys.sh script must not use $PKG_CONFIG as we export that. (Cstim says: Sorry, I replaced too much of pkg-config calls - my fault.) Fixed in r15224.

Creating a binary package

A script that copies everything that is needed for providing a binary has been added to SVN into packaging/win32. Its name is dist.sh and it will create the directory "dist" below the installation directory of gnucash, so by default the result will be copied to c:\soft\gnucash\dist .

Additionally, an input script to the Inno Setup Compiler has been added to packaging/win32. That one can be run after dist.sh has finished, and it should package up everything in the dist directory into a self-installing setup.exe file. Feel free to try that and report back whether it works.

DLL install error

I get an error like that:

'libgncmodule.la' 'c:/soft/gnucash/lib/libgncmodule.la'
/bin/install -c .libs/libgncmodule.dll.a
c:/soft/gnucash/lib/libgncmodule.dll.a
base_file=`basename ${file}`
  dlpath=`/bin/sh 2>&1 -c '. .libs/'${base_file}'i;echo $dlname'`
make[5]: *** [install-libLTLIBRARIES] Error 1
make[5]: Leaving directory `/c/soft/repos/src/gnc-module'
make[4]: *** [install-am] Error 2

This seems to be only an installation problem. Fine compiling it seems.

I saw this at "make install" when I stopped and restarted the preceding compiling several times. So to me this looks like an artifact of DLLs that somehow "don't fit" to each other. The solution was always to run "make clean" in the source directory so that all DLLs are being deleted, and then starting the compiling again. --Cstim 05:55, 4 December 2006 (EST)
'make clean' in the repos/ and afterwards a rerun of install.sh really worked! thanks a lot Calmar 08:47, 4 December 2006 (EST)
actually it seems to be necessary here: to make 'make clean' in the repos/src/ dir *and* afterwards 'make clean' in the repos/ directory. Cheer Calmar 08:14, 12 December 2006 (EST)
I don't think so. "make clean" in the repos/ directory calls the same thing in repos/src, but not vice versa. "make clean" in repos/ should clearly be enough. Anyway, this only concerns people who re-use an existing repos/ directory. --Cstim 04:53, 13 December 2006 (EST)
Yeah, that's the logical thing in my mind too. It just regurarly fails with a 'make clean' in repos only. Maybe it's only here anyway for some reason. I'm happy enough I can get it compiled/installed. (I get that error also after removing the repos directory completely and then an install.sh btw (win2000)) Cheers and thx Calmar 07:31, 13 December 2006 (EST)

cannot move on swigwin

Extracting swigwin-1.3.29.zip ... done mv: cannot move `mydir/Examples' to `./Examples'. I copied them manually then Calmar 08:48, 4 December 2006 (EST)

I guess the swig installation is not perfect with regard to updates. I will try to improve that. Meanwhile, removing the c:\soft\swig directory completely should solve the issue. -- andi5

Text reports crash

Some text report crashed instantly, but on some other machines they worked fine. Same for graphical reports. Debugging is ongoing. When you run gnucash in gdb, the crash does reliably not occur the text reports.

What we currently know: GnuCash spits a warning ([1]), but does not crash because of it. It crashes because of something different (in WinAPI?) we cannot detect in gdb. isDebuggerPresent() might be true, but a breakpoint will only be set for fatal errors, so we cannot set a breakpoint. We also cannot start gnucash with --g-fatal-warnings though, as a standard win32 glib build aborts the application after a critical error [2].
The issue is described in this bug and a solution is committed in SVN's install.sh in r15213. Hopefully, these crashers are fixed now :) I think removal of c:\soft\regex, \guile, \tmp\guile-1.6.8 and \gnucash (the previous installation) is necessary. -- andi5
Thanks for the fix in r15213! Indeed I don't see any crash anymore, and even the graphical reports (wohoo!) work correctly. (The warning of [3] is still there, though.) --Cstim 10:50, 15 December 2006 (EST)

GConf/ORBit COMM_FAILURE

On some computers (Windows 2000/SP4), the following error has been observed, but on other computers GConf runs fine. GConf shows plenty of error messages like these: "Failed to save key /apps/gnucash/window/pages/account_tree/name_visible: Adding client to server's list failed, CORBA error: IDL:omg.org/CORBA/COMM_FAILURE:1.0" and also the "Cannot find default values" dialog is shown on each startup, regardless whether the "setup" is done or not. Also, the startup of GnuCash might open dozens of shell windows one after the other, and the startup of GnuCash is incredibly slow.

This is being reported to the ORBit crew as bug#363648. As a quick workaround, you have to install ORBit2-2.13.3 from here instead of 2.14.2, as this seems to fix that problem.

Failed to fork

When starting GNUCash I receive the following message:

gnucash: [E] "Failed to fork child process."

It is not a fatal error (program continues to load). Is this something I can safely ignore? --Scbash 17:10, 3 December 2006 (EST)

This is from the file process.scm and it concerned with the Finance::Quote script for stock price retrieval. Chris wrote: "That's process.scm which is run during price-quote retrieval. Perhaps guile's (primitive-fork) doesn't work on win32." You can ignore this for now. On the other hand, this means Finance::Quote and price retrieval currently doesn't work yet. --Cstim 16:07, 4 December 2006 (EST)

Reading/writing compressed files

The current win32 SVN code doesn't read or write compressed (gzip'd) files. On Linux, gnucash forks gzip as a child process and pipes the file through it. On windows, there isn't an easy replacement for fork() and pipe(). See src/backend/file/io-gncxml-v2.c:1246 ff.

As a consequence, a linux-stored data file which, by default, is stored in compressed form cannot be read by the Windows version at the moment. If you want to use the linux datafile, you need to switch off file compression beforehand. Or 'mv datafile datafile.gz && gunzip datafile.gz #providing a .gz suffix, and finally enzipping it'

no code for module (srfi srfi-39)

  • Thank you for the prompt responses! i am continuing my reruns of the install.sh script and so i should get fresh copies of things in the repos directory and use them instead. i will have to check whether install.sh line 205 has the rxspencer directory removed from regex_lib variable also. the problem with using the same computer for multiple-tasks is that these compiles basically chew up 95+% cpu.
    • im guessing that there must be some fix in the rxspencer regex directory that is required. the compile finally finished and i saw the dos-screens come up and even (briefly) some tip-of-the-day type of box with the gnucash-splash-screen in the background.
    • then, the bin failed with a back-trace in qif-parse.scm:9:3: unbound variable: make-regexp
    • i pulled r15223 but am not sure whether it would fix these issues. help?
ive checked the downloaded regexp-spencer-3.8-lib.zip and the regexp.h inside ./include/ matches the one placed at the default location - so my hack to install.sh line 205 is ok. im guessing it is actually a code-issue with the qif-parse routines... Hfelton
  • all issues listed above fixed with r15224 version of install.sh
    • i give up - i believe that something is still wrong, but i have no idea what it is. it might be related to this bug[[4]] or it might not. i tried changing C:\soft\repos\src\import-export\qif-import\qif-parse.scm to see what the issue might be with the regexp. unfortunately, when i went to the repos-dir and ran make, i ended up with the exact-same-error (even tho id changed the actual regexp call distinctly). thus, i assume that some dependency was not triggered correctly and am too tired to try and fight any more today.
    • in case it helps, here is a long directory listing of c:\soft\downloads which is the default place where install.sh/custom.sh were used/modified: Hfelton
Please update install.sh and rebuild guile, i.e. remove c:\soft\guile and c:\soft\tmp\guile-1.6.8, then run install.sh. I could imagine that guile searched for regex, did not find it and thus did not include functions that use it, like make-regexp. -- andi5
thanx again - i did as requested and the compile halts with error: no code for module (srfi srfi-39) which is odd since it does exist in C:\soft\guile\share\guile\1.6\srfi (as before). in desperation, i tried removing all dirs except downloads and msys - and starting over - but guile will still not compile. (i was guessing that regexp mightve influenced something else like readline) any clues? tia, Hfelton
I cannot see how readline is involved. But c:\soft\guile\bin\libguile-srfi-srfi-*.dll depend on regex.dll, do you see them? And do you still have some spurious incorrect REGEX_CPPFLAGS (test with `echo $REGEX_CPPFLAGS, see c:\soft\msys\etc\profile.d\installer.sh)? I cannot say why that would hurt, but it would it be interesting. If nothing helps, please be more specific about what fails where and what does it print? (just built guile successfully). -- andi5
yes, files are being created - build fails at the install i think. i was trying to understand where but could not locate it. will research a bit more. i do not have a profile.d, just a profile at that location. i did a quick compare of the dirs from guile-worked-earlier to guile-not-currently-working and the difference is 1 file (out of the 471 or 472 files in 18 dirs) im guessing it is the final-step. the error said something about guile-not-installed-correctly and gave the exact halt-error i noted above. the missing file appeared to be c:\soft\guile\share\guile\1.6\slibcat -- Hfelton
uh - nevermind? it seems tove worked (i guess i needed to shut down the msys window i had been using before and this cleared out the environment?) this time! it is currently working thru the gnome-build again and going strong... should i/we delete this whole section? -- Hfelton

Todo

This section is intended mainly for developers to concisely specfiy what issues are open, assigned or closed (and can be removed then).

[ ] R  Text report crashers (Bug, Bug)
[ ] R  GConf/ORBit2
[ ] R  SWIG installation (minor)
[ ]    Finance::Quote
[ ]    AqBanking
[ ]    Packaging
[ ]    Randomness (Mail)
[ ] R  Compressed files
A lot more, fill me