Difference between revisions of "Windows"

From GnuCash
Jump to: navigation, search
(Creating a binary package)
(Q: Is it possible to compile GnuCash on Windows?: win 9x does not run gnucash)
Line 4: Line 4:
  
 
=== Q: Is it possible to compile GnuCash on Windows? ===
 
=== Q: Is it possible to compile GnuCash on Windows? ===
:'''A:''' Well, compiling is possible, and running as well, but so far not everything runs.
+
:'''A:''' Well, compiling is possible, and running as well, but so far not everything runs.
 +
 
 +
Note: Testing indicates that the Windows 9x line (Windows 95, 98, ME) does not run GnuCash.
  
 
=== Q: So, where is the binary? ===
 
=== Q: So, where is the binary? ===

Revision as of 19:09, 30 December 2006

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.

Note: Testing indicates that the Windows 9x line (Windows 95, 98, ME) does not run GnuCash.

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.

r15246

Please note that for r15246, removal of both, c:\soft\gnucash and c:\soft\repos, is strongly recommended.

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.

r15224-error unzip: command not found - basically the environment isnt getting setup from custom.sh completely. in particular, function inst_unzip() from install.sh. Hfelton
Did you execute the commands install.sh printed after it finished? These will make both, your running MSYS shell as well as new ones, ready for dist.sh. You can easily see them if you rerun install.sh, but comment out add_step svn_up and add_step inst_gnucash in dist.shcustom.sh first, otherwise be prepared to wait again ;-) -- andi5
"unzip not found" has been fixed by r15244.
ive been modifying install.sh (adding profile.d/inno-setup) and im wondering who/where to submit changes. h 17:55, 19 December 2006 (EST)
As written in README or HACKING: Send message to the Mailing Lists gnucash-devel.
Sent to the list [1], applied in r15241.
i was unable to do the shortcuts described, but after the long-wait i WAS able to complete/test everything and it worked! steps i needed to do were: 1) manually create c:\soft\msys\etc\profile.d directory; 2) copy/paste the commands that got printed out due to the finish function which setup the environment variables into installer.sh (created manually inside profile.d); 3) open a new mingw-window (environment is ok now) and run dist.sh; 4) download/install the inno-setup-quickstart-pack (easier to use than generic innosetup); 5) run inst-tool and open the c:\soft\repos\packaging\win32\gnucash.iss file; 6) compile, then test-run/install gnucash in the 'normal' program_files location! only thing that sorta didnt work was that i tried running the tutorial and the doc-system was not installed... anyways - i think most of the initial-profile-issues would be cleared up with a few adjustments to the install.sh script (which cannot be run from the repos\packaging\win32 location directly because it tries to svn-up itself and fails).
1) is fixed in r15246 by printing the command. Automagic creation of /etc/profile.d/installer.sh has been rejected ([2]). 2) will stay necessary. dist.sh sets its environment since r15244 (see unzip above). 4) got obsoleted by inst_inno
Experimental packages:
http://gnucashw32.zip.io 
ftp://gnucashw32.zip.io:anonymous@gnucashw32.zip.io
or: 
http://gnucash.calmar.ws 
ftp://gnucash:win32@calmar.ws/httpdocs/win32

ok - i guess this is a creation-issue. im mentioning it here so that anyone outside the devel-mailing-list might notice it before trying to run the "nightly" build files. r15246 seems to be creating a 'working' system. the iss-file indeed compiles something that is 26mb, but it fails after printing the tip-of-the-day with an error-msg: GnuCash engine failed to initialize. aborting. also, the iss-file was located in 2 places, neither of which would be my initial guess: c/soft/gnucash and c/soft/BUILD/packaging/win32/gnucash. i figure it is not worthwhile to upload this exe-file anywhere yet. h 05:57, 22 December 2006 (EST)

There are different files matched by gnucash.iss*: gnucash.iss.in may lie where you checked_out/copied packaging/win32 and is not used at all. \gnucash\repos\packaging\win32\gnucash.iss.in is read by configure (config.status), variables are substituted and the result is written to \gnucash\build\packaging\win32\gnucash.iss. dist.sh copies this file to \gnucash, so that the Inno Setup Compiler will create the setup.exe there too.
For "engine not initialized", see below. From my POV we should not start nightly builds before main runtime problems have been solved. -- andi5

Hi, Hfelton since it's probably you, who is maybe willing to build 'nightly' packages (I can not really, because I'm a linux user first of all, and e.g. always startup MSwin spending hours there without beeing able to work on other stuff... at the same time, can't work. It would have to be a background-thing) Anyway, about that zip.io site. I just wanted to say, it would be possible on gnucash.calmar.ws to prevent the problem you mentioned on zip.io - There the user can get a directory listing (that win32 dir, I setup like it with an according .htaccess file, maybe that would work on your system as well), and that without ftp access. So they can't change anything there really, but still get folder-access. Only developers like you could. (I mean, there would be the need to remove the ftp link then and keeping the password secret or so.) That would actually prevent malicious packages to quite some degree. At least here (.ch) the download is quite faster as well. Probably I won't do any further builds in the near future, also because of the problems on my win2000 System I always have with it. Just some thoughts about it. Again, I wish you all a good year! Calmar

Runtime issues of binary package

I have completed install.sh; the installed gnucash.bat can be started from Start->Execute and gnucash will run fine, including all features that are available.

Now I'm working on the binary package. I have run dist.sh, followed by "ISCC.exe gnucash.iss", which created the 27MB setup.exe of gnucash. This can be installed and uninstalled just fine. However, when I run the gnucash.bat from that installation, the "Reports" menu does not appear. (Additionally, various error messages are printed into gnucash.trace.) After r15236, gnucash won't start up in this case but instead it will abort with the message "engine initialization failed". I'm trying to track down when the initialization fails, and when it doesn't.

i have not yet joined the mailing-lists [will soon], but there are definitely subtleties with this installation-process. my interest lies in the prior shell-scripts, but i can tell you that the iss-file needs some ispp-work applied to it, imho. ---begin soapbox--- iscc needs to make the app-name a one-time-variable, etc. until the script has been generalized, it is going to be a bit flaky. also, until a test-harness has been installed - ANY code can be a bit flaky. setting up a test-harness is hard work. ive spent a fair-amount of time just trying to understand the single-function quiet in the install.sh script because of subtleties in the trap-function of the mingw-shell that are coming to light via a mini test-harness. ---end soapbox--- h 16:28, 20 December 2006 (EST)
  1. It works when running gnucash in the $prefix directory, from gnucash.bat that was generated by install.sh.
  2. It fails appear when running gnucash in the installation directory where the setup.exe was installed, from gnucash.bat that was generated by setup.exe.
  3. It fails when running gnucash from the $prefix/dist/ directory, when editing the gnucash.bat of step 1 to change all $prefix paths into $prefix/dist for the gnucash parts, leaving the other paths unchanged. The errors in gnucash.trace include the following:
Error: gnc_component_manager_init(): component manager already initialized
gnc_options_ui_initialize: assertion `optionTable == NULL' failed
plugin_services_init: assertion `services == NULL' failed
plugin_service_define: assertion `NULL == g_hash_table_lookup (services, type_str)' failed
  • It works when moving the $prefix directory to some other name, and editing the gnucash.bat of step1 to change all $prefix paths accordingly for the gnucash parts, leaving the other paths unchanged. So the problem might be related to the file copying of dist.sh
Note that gnucash.trace, when compared to step 1, now has the error message "Warning: qof_session_load_backend(): failed to load gncqof-backend-qsf from $prefix/lib", which is understandable because the loading point of the QSF backend (lib/libqof/qof/qofbackend.c) is the very last place in gnucash where a hard-coded path is used instead of a relocatable solution.
  • It fails when copying $prefix/* (everything from that directory) to /some/where and editing gnucash.bat. (It used to work once, but after r15236 it always failed in this case.) It fails regardsless of whether the target directory is below $prefix or not, and also regardless of "cp -r", or "cp -a", or the Windows explorer for copying, or using zip/unzip for copying.
    • Really really weird. If you make "mv $prefix foo" (and adapt gnucash.bat), it works, but if you make "mkdir foo; cp -r $prefix/* foo" (and adapt gnucash.bat), then it doesn't work.
Business as usual: Works for me. The only thing i needed is the oneliner in r15239. Will test on a vanilla computer tomorrow. -- andi5
The fix seems very good, but even with r15239 I still get the above problem. --Cstim 06:06, 21 December 2006 (EST)
i think the mv-command might be broken-slightly in mingw. i know that chmod doesnt seem to work. (i tried to manually create a new.sh file and mingw/windows would not let it execute unless i changed it to a *.bat or *.exe file) cygwin seems to have its own ideas, and tab-autocomplete is also unique to the two systems. i only mention cygwin in passing - i do not use it for anything other than curiosity here. -- h
I do not understand that, please be more specific why mv is broken (example & error message). What did you use to execute new.sh? Shebang is there? There is no executable bit on windows anyway.
r15248 has landed, please reevaluate. -- andi5
I installed it today on a older (400Mhz) win2000 box, and everything worked fine: Install/startup/report.... I installed it on a D: partition. I did not deeply check all the gnucash functions, so. Very nice, thanks!Calmar

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)

Now I got that: http://rafb.net/p/zYqOJv60.html (also after removing the whole soft directory (besides the downloads dir).Calmar

So you have got these errors in at least three different directories and also in a clean environment. The problem always seems to be a missing .lai file. But surprisingly other directories (among them those that failed in other builds) contain such files. The only solution I know is still to cd into the offending directory and to run make clean && make all install. I am sorry for the inconvenience. -- andi5
wohoo wohooo wohooo!!! I was able to solve the problem, with ./install.sh until it comes through. After the 5th try or so, it came through :) Very happy I can satisfy now what I promised to my friend (I mean new year is a good start for him). Thanks again for all your help! Good new year everybody!

cannot move on swigwin

Extracting swigwin-1.3.29.zip ... done mv: cannot move `mydir/Examples' to `./Examples'. I moved it 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 ([3]), 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 [4].
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 [5] 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 unzipping it'

Todo

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

[X] 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