Friday, February 29, 2008

armenzg: Sess14: Building Cairo on Mac; No problems?? No way!!

It has been quite a long time and time constraints are always flying on top of me (like most of you reading this)
Anyways, I am going to work on writing the steps to build Cairo on Mac, let's see if there are differences


NOTE: This has been my longest session when I expected to spend just an hour or two - I have found so many obstacles that I cannot recall all of them

NOTE2: No performance tests and the "make test" takes a pretty LONG TIME - More than 30 minutes (In Linux I believe it took shorter time, not sure)

Requirements

  • sudo port install git-core
  • sudo port install buildbot
svn is not in ports' repository (I think I just saw svn extensions for python and perl) so I can get if with Fink or get an installer (Subversion .dmg); I decide to go the command line way:
  • sudo port install autoconf
  • sudo port install automake
  • sudo port install libtool //I think I did: fink install libtool instead

Set-up

  • mkdir sandbox && cd sandbox
  • buildbot create-master cairomaster
  • cd cairomaster
  • I tried to checkout buildbot-configs/cairo-one-ubuntu-slave/master.cfg from my repository but svn does not checkout single files; But I placed the master.cfg to the ~/cairomaster folder
  • buildbot create-slave ./cairoslave localhost:9876 macslave slavepassword

Running

  • buildbot start cairomaster/
  • buildbot start cairoslave/
  • firefox http://localhost:8020

Conclusion

One of my longest sessions and with more problems ever!!!! Read below all my obstacles and I hope that all that I have done will help the cairo developers, in fact, cworth from the cairo channel was really helpful and he made some changes to the INSTALL file to reveal some of the things I have discovered. I love the new section called "Extremely detailed build instructions" that he has added :D

Obstacles

The autoconf and automake that come with MacOS X are not good for what I am trying to do (http://osdir.com/ml/finance.quantlib.devel/2005-09/msg00001.html ); I don't know if both or just one of them, but read below:

  • sudo port install automake // because when I try to do .autogen.sh I get the following error (even though I have libtool installed):
    NOTE2: later when trying to ./autogen.sh in cairo's folder I had a similar problem and I got libtool from Fink since MacPort was skipping since I already had libtool; After that it worked

    Can't exec "libtoolize": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 288, line 3.
    autoreconf: failed to run libtoolize: No such file or directory
  • I don't know what I did, I might have got autoconf from Fink or MacPorts // when I try to run ./autogen.sh with cairo I get this error:
    ./autogen.sh: line 177: libtoolize: command not found
  • I did not know how to configure PKG_CONFIG_PATH but now I do:
    PKG_CONFIG_PATH=/Users/armenzg/Sandbox/libs/lib/pkgconfig //since I configured pixman to build there and it created a pkgconfig folder with a .pc file
    export PKG_CONFIG_PATH // to export to the environment variables
  • After setting up the PKG_CONFIG_PATH properly and tried again to ./autogen.sh:
    configure: error: Cairo requires at least one font backend.
    Please install freetype and fontconfig, then try again:
    http://freetype.org/ http://fontconfig.org/
  • I ended up doing "sudo fink install fontconfig" because neither through Fink or MacPorts I got it working
  • Another problem, after doing a "make":
    libtool: ltconfig version `' does not match ltmain.sh version `1.3.5'
    Fatal configuration error. See the libtool docs for more information.
    make[2]: *** [libcairo_la-cairo.lo] Error 1
  • The libtool that comes with MacOS X is not the one we want (thanks cworth from #cairo channel on freenode):
    LIBTOOLIZE=glibtoolize ./autogen.sh --prefix=/Users/armenzg/Sandbox/libs
  • This last problem was found when I wrote the buildbot steps and I was trying to set environment variable PKG_CONFIG_PATH but that is not Shell Command and I found through bhearshum that I can do this:
    macFactory.addStep(step.ShellCommand, name="autogen for cairo",
    descriptionDone="autogen for cairo",
    command=["./autogen.sh","--prefix="+mac_build_prefix+"/lib"],
    workdir="cairo",
    env={"PKG_CONFIG_PATH": '%s/lib/lib/pkgconfig' % mac_build_prefix,
    "LIBTOOLIZE": 'glibtoolize'})