[GNC-dev] Build on MacOS
jralls at ceridwen.us
Fri Feb 28 23:06:02 EST 2020
Please remember to copy the list on all replies.
> On Feb 28, 2020, at 8:26 PM, jean laroche <ripngo at gmail.com> wrote:
> Thanks for the pointers John! Very useful! As a newbie building this, I have no idea what's important and what not. Here are my notes.
> Note that a lot of this is hacking, trying to get to a point where I can build. The solutions are just band-aids, and they may not be good ones either!
> • Build complained about perl XML parser. I started a shell at the point where it failed and followed this. perl -MCPAN -e shell, followed by install XML::Parser. This fixed it.
xml-parser, along with several other critical infrastructure packages, is installed by `jhbuild bootstrap-gtk-osx`, which you need to run before starting the build proper. I wonder how you were able to proceed without that.
> • There was an error finding gpg-error.h, which is here: /usr/local/Cellar/libgpg-error/1.37/include/gpg-error.h so I did ln -s -> /Users/gnucash/gnucash-stable/include/gpg-error.h
Gtk-OSX is incompatible with Home-brew. Not only must you not try to install into /usr/local/Cellar, you must purge your environment of any paths (PATH, DYLD_LIBRARY_PATH, PKG_CONFIG_PATH, etc.) pointing into it. Same for MacPorts.
Note that the Home-brew recipe for GnuCash simply downloads and installs the Mac release bundle from our distribution repository: Even they don't support building GnuCash from source. MacPorts does, but you have to decide to use either MacPorts or Gtk-OSX.
> • Had to do brew install postgresql
> • Got: “configure.ac: No such file or directory” Went into shell copied everything from /Users/gnucash/gnucash-stable/src/libgpg-error-1.27 locally, and retried. It worked.
That's the wrong thing to do. Instead cd to the source dir and run either `autoreconf -fis` or `./autogen.sh`.
> • Xmlsec refused because of “dirty” dir. I removed the entire xmlsec directory. But then I get an error with cp -u which does not work on macos, which I fixed by removing -ru in line 749 of docs/Makefile.* and 619 in docs/api/Makefile.*
How did you remove the directory? The correct way is to use selection 6, "delete directory and start over" from the jhbuild error menu. It should take care of getting the build restarted. OTOH I usually pick 2, "ignore the error and continue to configure" because it's frankly not that important to have the latest xmlsec code.
> • Ran into a problem with libdbi-drivers: Had to add -L/Users/gnucash/gnucash-stable/build/libdbi-drivers-0.9.0/drivers/mysql to the Makefile located there, and link /usr/local/Cellar/mysql at 5.6/5.6.46_2/lib/libmysqlclient.18.dylib there as well.
See above about Home-brew.
> • Ran into: “can’t find cgreen/parameters.h” for libdbi-drivers-0.9.0. I linked /Users/gnucash/gnucash-stable/src/libdbi-drivers-0.9.0/tests/cgreen/include/cgreen to the target dir. That fixed it.
I've been meaning to write a patch about that.
> • Intltool complained about version. I have the right version, so I removed check in the configure file.
It probably couldn't find the right version because of Home-brew.
> • Then I was missing aclocal-1.15 … Ran autoreconf -f -i as suggested.
> • For libsoup same complaint about intltool version. Same action.
> • Building shared-mime-info: manuallly ran configure --disable-dependency-tracking, then skipped to build, but hit Makefile 1161: *** missing separator. Edited. Also changed INTNL-UPDATE to intnl-update in Makefile.in.in in po. Also remove everything after “check” at line 149 same file.
> Then I get a hard crash:
> OSError: [Errno 2] No such file or directory: '/Users/gnucash/gnucash-stable/_jhbuild/root-shared-mime-info/Users/gnucash/gnucash-stable'
> File "/Users/gnucash/Source/jhbuild/jhbuild/frontends/buildscript.py", line 172, in build error, altphases = module.run_phase(self, phase)
> I added a pdb.set_trace() in the python script and created the dirs, then continued the command. That worked.
> It would be great if you could tell me if these errors ring a bell for you, and what better steps I should have taken to fix them... Not knowing anything about this build process I went for the most expedient solution I could find, chances are, not the best!
> Thanks! I appreciate the help!
> BTW: swig-unittest-support-guile.c is nowhere to be found in the tree, neither built nor src, so something's not right.
Unfortunately you've probably screwed up your Cellar on top of everything else so you might have to wipe it and reinstall Home-brew.
The easiest way to get a clean environment for building GnuCash is to create a new user and switch to that user for building with Gtk-OSX. Unfortunately there's no way to stop bash from reading the environment it's launched from so I think that the only other option is to create a different .bash_profile and .bashrc with no Home-brew configuration and play name-swap, then open a new terminal session. IMO switching users would be easier.
More information about the gnucash-devel