[GNC-dev] Build on MacOS

John Ralls jralls at ceridwen.us
Sat Mar 7 23:27:02 EST 2020

> On Mar 6, 2020, at 9:27 PM, jean laroche <ripngo at gmail.com> wrote:
> Thanks John,
> Tonight I was able to successfully run jhbuild build, then to build and run gnucash on my mac at home.
> Doing so required some manual fixes which I'm listing below. If it's not possible to patch them, at least they should be mentioned in the instructions for building on mac. I would be willing to update them if so, I would just need directions on how to do that.
> Here are my notes for the errors I'm still getting when running jhbuild build. I would love to hear what your take is on these 3 issues.
> 	• I ran into the libxml2 issue (libxml2 is missing so itstools can't be built). Dropped to shell, tried pip3.6 install libxml2-python3. That worked on my machine at work. John says instead to create links form python -> python3.
> On the home mac, that did not work, some includes could not be found to build libxml2. I found that I needed to ln -s "/Users/gnucash/gnucash-stable/include/libxml2" "/usr/local/include/." and ln -s /Users/gnucash/gnucash-stable/src/libxml2-2.9.8/os400/iconv/iconv.h /usr/local/include/.  I don't know why this happened on my home mac, but not on my work mac. 
> 	• Ran into xmlsec error (dirty dir)
> . I tried [6]. Then another error occurred: I had to update the two Makefiles (replace -ru by -r or replace cp by rsync) in docs and docs/api and that worked. Rsync should be used instead of cp because cp -ru does not exist on the mac, instead rsync -ru does. 
> 	• Got the error: Your intltool is too old. This is caused by perl v 5.26 (see https://github.com/raspberrypi/noobs/issues/470
> ) which does not accept unescaped { and } in regexps. I patched intltool-update by looking for ${ and adding\ to { and }. Seems to have fixed it, but it was tedious to say the least.
> But other than these 3 errors, all the rest now works fine. Thanks for all the required updates. I understand that once you have your build environment you don't need to re-create it, so I imagine it's not obvious to detect when jhbuild build fails for one reason or another.

I pushed just before supper changes that for me anyway get it to build all the way through without intervention. One of the changes is to jhbuildrc so you need to rerun gtk-osx-setup.sh or have a git clone of gtk-osx to pull to to get it. Alternatively you could add the line
  os.environ['PYTHON'] = "/usr/bin/env python3"
to jhbuildrc-custom.

You should have *nothing* in /usr/local. Homebrew uses that and it's risky because Apple has in the past clobbered /usr/local as part of a system upgrade. Everything for building should either be in $PREFIX (aka $JHBUILD_PREFIX) or in the virtenv.

The xmlsec version is locked in the module set so it doesn't matter a whit if it can't switch the dirty tree. Just tell it to ignore the problem and continue to configure.

Intltool hasn't been maintained for a long time so it's not too surprising that newer perls choke on it or cause it to choke. Fiddle your jhbuild environment so that it finds the system perl: Apple hasn't updated perl for about as long as it's been since intltool was last updated. That said, I wonder if intltool is even needed any more. I'll run a few tests.

John Ralls

More information about the gnucash-devel mailing list