MacOS/Quartz

From GnuCash
Revision as of 13:48, 7 May 2007 by GlenWhitney (talk | contribs) (Now that this is linked directly from the GnuCash home page, add a bit more warning and a link to bail back to the easy X11 install methods.)
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.

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.)

  1. readline-5.2, ftp.gnu.org/pub/gnu/readline, ./configure --prefix=/opt/gtk
  2. guile-1.6.8, 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
  4. libIDL-0.8.8, http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/, standard configure
  5. ORBit2-2.14.7, http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/, standard configure
  6. GConf-2.18.0.1, http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/, ./configure --prefix=/opt/gtk --enable-static --enable-shared --disable-scrollkeeper --disable-xlib (note the --enable-static here)
  7. OpenSP-1.5.2, download.sourceforge.net/openjade, ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-doc-build
  8. libofx-0.8.3, 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-1.10.4, rpm.net.in/mirror/rpm-4.4.x, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  10. audiofile-0.2.6, ftp.gnome.org/pub/gnome/sources/audiofile, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  11. esound-0.2.37, ftp.gnome.org/pub/gnome/sources/esound, ./configure --prefix=/opt/gtk --disable-static --enable-shared
  12. dbus-1.0.2 and dbus-glib-0.73, dbus.freedesktop.org/releases/, for each one: ./configure --prefix=/opt/gtk --disable-static --enable-shared
  13. gnome-mime-data-2.4.3, gnome-vfs-2.18.0.1, libbonobo-2.18.0, libgnome-2.18.0, libbonoboui-2.18.0, from http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/, standard configure for each one.
  14. gnome-keyring-0.8.1, http://ftp.gnome.org/pub/GNOME/desktop/2.18/2.18.1/sources/, standard configure
  15. Download and extract libgnomeui-2.18.0.1 from http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/
    Then, 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 ()); */
    

    Then ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib --without-x, and make and make install.

  16. libgnomecups-0.2.2, http://ftp.gnome.org/pub/gnome/sources/libgnomecups, standard configure
  17. Download and extract libgnomeprint-2.18.0 from http://ftp.gnome.org/pub/GNOME/desktop/2.18/2.18.1/sources/
    Then, in the libgnomeprint directory: insert line 23717 in configure:
      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.
  18. libgsf-1.14.3, http://ftp.gnome.org/pub/gnome/sources/libgsf, standard configure
  19. pcre-7.1, ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, ./configure --prefix=/opt/gtk --disable-static --enable-shared --enable-utf8
  20. libgoffice-0.3.8, ftp.gnome.org/pub/GNOME/sources/goffice, standard configure
  21. Download and extract gtkhtml-3.15.1.tar.gz from ftp.gnome.org/pub/GNOME/sources/gtkhtml
    Then, execute the configure command GAIL_CFLAGS=" " GAIL_LIBS=" " ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib; next, 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.

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!