MacOS/Quartz

From GnuCash
Revision as of 21:16, 31 January 2008 by Jralls (talk | contribs) (GnuCash's many other requirements)
Jump to: navigation, search

This page describes the process by which I was able to get GnuCash 2.1.1 running with the Gtk+ on Mac OS X libraries. These libraries build on top of Apple's Quartz graphics/windowing system, making the resulting GnuCash application entirely independent of X11. This means also that the resulting GnuCash executable runs as its own independent application in the Mac OS X sense. For example, it gets its own entry in the Dock, rather than being subsumed into the X11 entry. Note, however, this is a lengthy process that involves compiling many source code distributions of various packages, some of which need minor edits (I haven't had a chance to make proper patchfiles). See MacOSXInstallation for the summary of other methods of installing GnuCash on the Mac, which use X11 but are much more straightforward.

Overview

The sequence of steps here worked for me one time on a G4 Power PC running Mac OS X 10.4. I'm trying to automate this process using MacPorts so that I can reproduce it, won't have to do it again by hand, and can upgrade practically as newer versions of the components are released. (If that gets to a workable state, I'll update these instructions.)

Before you begin, there are a few important caveats: First, a number of the modifications below are only for the sake of getting GnuCash to run. They're not appropriate for using these packages with other software. That's why it's important to keep this installation segregated from other software on your computer. Second, as the Gtk+ on Mac OS X describes itself, it's a work in progress and not ready for general use. There are likely unknown bugs lurking. I would not recommend this build for use with any really important data. That being said, I have found the usability over the past few days to be fine, I think it looks nicer than the X11 version, and it's nice not to have to invoke X11. Anyhow, here goes:

Basic Gtk+ build

  1. Install git and subversion from MacPorts or Fink.
  2. Create a fresh new user account (e.g. "gtkbuild") without the MacPorts or Fink environment variables and path, and link just the git/subversion executables into a directory added to gtkbuild's PATH.
  3. Follow the instructions to build gtk+ at http://developer.imendio.com/projects/gtk-macosx/build-instructions:
    1. First do the "bootstrap"
    2. Then the "core"
    3. And then build all of the modules in the "Extra:" list printed when you execute gtk-osx-build help, one by one in the order on that list.
  4. Execute gtx-osx-build shell to get the proper environment, and execute all further commands in the resulting shell.

Update January 2008: This procedure is now controlled by a Python program called jhbuild. Git isn't needed anymore, and subversion is provided by Leopard. If you're still on an older system, you'll need to get it separately. The instructions at the link above will take you through installing jhbuild and its environment, then building GTK+.

Be sure to do the rest of your building inside the shell created by jhbuild shell

Otherwise you'll need to set a bunch of environment variables at various stages.

GnuCash's many other requirements

Next is a long series of download-configure-build-install cycles to get all of the packages GnuCash depends on. For each one, I give the package name and version, a URL to download from, and a configure command. If there are no other instructions, you download the tarball from the given URL, extract it (e.g. tar -zxvf <tarball filename>, cd into the top level directory extracted, execute the configure command, and then execute make and then make install. The "standard configure" command listed in many cases below is ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib (probably in many cases not all of these options are necessary or even operational, it's just convenient to have one command that can be used in as many cases as possible.) Note that there's nothing magic about /opt/gtk; you can use anything you want for a prefix (but you should stay away from places used by OSX, Fink, or MacPorts). If you leave off the prefix, most of these packages will default to installing in /usr/local.

In order to compile libgnomecanvas, which is required by libbonoboui, you'll need to add the X11 pkgconfig directory to PKG_CONFIG_PATH. For Leopard, do export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/X11/lib/pkgconfig from inside the jhbuild shell.

Next get, build, and install the following additional libraries. GNOME means http://ftp.gnome.org/pub/GNOME/platform. You'll go down three levels, to major-version/version/sources, with major-version being something like 2.20 and version being like 2.20.1. SOURCES means http://ftp.gnome.org/pub/gnome/sources. In general you'll want the latest versions because jhbuild retrieves its sources directly from svn.

  1. readline, ftp.gnu.org/pub/gnu/readline, ./configure --prefix=/opt/gtk
  2. guile, ftp.gnu.org/pub/gnu/guile, standard configure.
  3. Download slib3a4 from http://swiss.csail.mit.edu/~jaffer/SLIB.html and unzip it. You then need to link the top-level directory created by the unzipping into the guile library directory:
    ln -s <slib directory> /opt/gtk/share/guile/1.6
    

    (or whatever version of guile you installed). Next

    mkdir /opt/gtk/share/guile/site
    

    Start guile and run the following lisp commands:

    $guile
    guile> (use-modules (ice-9 slib))
    guile> (require 'new-catalog)
    guile> (quit)
    
    Slib is now ready to use.
  4. libIDL, GNOME, standard configure
  5. ORBit2, GNOME, standard configure
  6. GConf, GNOME, ./configure --prefix=/opt/gtk --enable-static --enable-shared --disable-scrollkeeper --disable-xlib (note the --enable-static here)
  7. OpenSP, http://sourceforge.net/projects/openjade, ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-doc-build
  8. libofx, http://libofx.sourceforge.net, ./configure --prefix=/opt/gtk --disable-static --enable-shared --with-opensp-includes=/opt/gtk/include/OpenSP --with-opensp-libs=/opt/gtk/lib/
  9. popt, http://rpm.net.in/mirror/rpm-4.4.x, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  10. audiofile, GNOME, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  11. esound, GNOME, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  12. dbus and dbus-glib, http://www.freedesktop.org/wiki/Software/dbus/, for each one: ./configure --prefix=/opt/gtk --disable-static --enable-shared
  13. libart_lgpl, GNOME, standard configure
  14. libglade, GNOME, standard configure
  15. libgnomecanvase, GNOME, standard configure
  16. gnome-mime-data, gnome-vfs, libbonobo, libgnome, libbonoboui, from GNOME, standard configure for each one.
  17. libgpg-error and libgcrypt, http://www.gnupg.org/download/index.en.html, standard configure.
  18. libtasn1, http://josefsson.org/gnutls/releases/libtasn1/, standard configure
  19. gnome-keyring, GNOME, standard configure
  20. Download and extract libgnomeui from GNOME
    Under 2.18 the following was necessary:
    In the libgnomeui directory: Comment out the following section of the configure script at line 23836:
    #    if test x$GNOME_HAVE_X11 != xyes ; then
    #        { { echo "$as_me:$LINENO: error: libX11 not found" >&5
    #echo "$as_me: error: libX11 not found" >&2;}
    #   { (exit 1); exit 1; }; }
    #    fi
    

    comment out line 845 of libgnomeui/gnome-ui-init.c:

            /* XUngrabServer (GDK_DISPLAY ()); */
    

    But it wasn't for 2.21.
    ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib --without-x, and make and make install.

  21. libgnomecups, SOURCES/libgnomecups, standard configure
  22. Download and extract libgnomeprint-2.18.0 from GNOME
    Then, in the libgnomeprint directory, edit configure: You need the following line just after the "GLIB_GENMARSHAL" block; it was missing altogether in 2.18.1, and was just LIBM= in 2.18.3.
      LIBM=" "
    

    And then ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib --disable-gtk-doc.
    Next you need to change line 945 of libgnomeprint/Makefile from:

    	$(FLEX_PATH) -P_gnome_print_filter_parse_yy $^
    

    to

    	$(FLEX_PATH) -P_gnome_print_filter_parse_yy parse.l
    
    and finally do make and make install.
  23. libgsf, SOURCES/libgsf, standard configure
  24. pcre, ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, ./configure --prefix=/opt/gtk --disable-static --enable-shared --enable-utf8
  25. libgoffice, SOURCES/goffice, standard configure
  26. icon-naming-utils, http://tango.freedesktop.org/Tango_Icon_Library
  27. gnome-icon-theme, SOURCES/gnome-icon-theme, standard configure
  28. Download and extract gtkhtml from SOURCES/gtkhtml
    Then, execute the configure command GAIL_CFLAGS=" " GAIL_LIBS=" " ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib; The following was required for 3.15 but not for 3.17.90:
    • Delete line 260 of Makefile:
      	a11y					\
      
    • Delete ../a11y/gtkhtml-a11y.la from line 66 of src/Makefile, yielding
      	$(am__DEPENDENCIES_1) \
      
    • Delete ../a11y/gtkhtml-a11y.la from line 569 of src/Makefile, yielding
      libgtkhtml_3_14_la_LIBADD = $(GTKHTML_LIBS) $(GAIL_LIBS) $(REGEX_LIBS)
      
    • Comment out line 3170 of src/gtkhtml.c:
      /*	gtk_html_accessibility_init ();  */
      
      and finally make and make install.

Note: While building the various gnome libraries I encountered numerous uses of G_GNUC_FUNCTION and G_GNUC_PRETTY_FUNCTION. These should be replaced with __FUNCTION__ and __PRETTY_FUNCTION__; the original defines are in glib-2.0/glib/gmacros.h (which define them as empty for gcc 3.0 and later), but there isn't always an include chain leading back here.

GnuCash

Finally you're ready for GnuCash itself: Downloaded and extract gnucash-2.1.1 from gnucash.org. Then in the gnucash directory: Delete X11/Xlib.h from line 23494 of configure, yielding:

for ac_header in glob.h

then execute the configure command

   SCHEME_LIBRARY_PATH=/opt/gtk/share/guile/1.6/slib ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-gtk-docs --enable-ofx --disable-xlib

and the make command

   SCHEME_LIBRARY_PATH=/opt/gtk/share/guile/1.6/slib make
and then make install. Then
   mkdir /opt/gtk/libextra
   cd /opt/gtk/libextra
   ln -s ../lib/libgnc* ../lib/libguile* .

then edit /opt/gtk/bin/gnucash as follows: replace line 20, which is:

DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"

with the following two lines:

DYLD_LIBRARY_PATH="/opt/gtk/lib/gnucash:/opt/gtk/libextra:${DYLD_LIBRARY_PATH}"
SCHEME_LIBRARY_PATH=/opt/gtk/share/guile/1.6/slib
and insert the following line:
export SCHEME_LIBRARY_PATH
between:
export DYLD_LIBRARY_PATH
and:
exec gnucash-bin "$@"

Now cross your fingers and try running it -- you can execute gnucash from any shell, and the application should come up right within Aqua. One difference in the startup is worth noting here: under X11, a window pops up with a progress bar showing the loading of the data file, and then the main Gnucash screen comes up (with Accounts, etc.) Under Quartz at least at the moment, the progress bar never appears so you just have to be patient while your file is loaded.

Good luck!