Building IPP (v2.9) on Mac OS X (v10.6)


The following is a detailed description of the steps I (Mike Lum) have been following to build both the latest "trunk" and certain tagged versions of the IPP on a clean Mac OS X v10.6 "Snow Leopard" build.
Several Important Notes:

  • This is a clean operating system install, ie: On to a completely blank disk, with no additional packages installed.
  • [tlsd] is the top-level source directory for your ipp source tree.
    • In my case, it was: /Users/mikelum/Documents/Sources/ipp
    • I also tested using an external hard drive (eg: /Volumes/AstroDrive/Sources/ipp)
  • I used the "Terminal" application for my command line interface, launched from the Finder.
  • I used c shell, as opposed to the bash shell, which is the default of the Terminal app. Switch shells by entering "csh" at the bash command line.
  • Shell commands are delineated by text box offsets, and prefaced by a default command line prompt: %
  • My comments are interspersed, and prefaced by a shell comment character: #


System Setup

  1. This process was developed and tested on recent laptops (2006 MacBook and MacBook Pro and 2008 MacBook Pro), running a fully updated version of Mac OSX 10.6 (Snow Leopard)
  2. Download and install the Developer Tools package from Apple, particularly the UNIX tools. You don't really need the iPhone or other specialized tools, unless you are porting the ipp to an iPhone...
  3. Remove the "faked" libreadline in /usr/lib. The "faked" (linked dylib) will be replaced by a real libreadline in the build.


Source Checkout

  1. Check out your desired source code version.
    %cd [tlsd]
    %svn co https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp/trunk .
    

# It's also o.k. to use other, stable tags. This process has also been tested with:
# https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp/tags/ipp-20100525
# https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp/tags/ipp-20100602

Build Setup

  1. Configure your system for the IPP build (first time only).
    %cd psconfig
    %./psbuild -bootstrap [tlsd]/psconfig
    

# Until you have an alias for psbuild in your .cshrc file, the "./" is required.
# Regardless of what the documentation implies, DO NOT attempt to place the
# build target directory anywhere but in your [tlsd]/psconfig directory!

  1. Copy the output lines, as described, to your ~/.cshrc
  2. Re-start your shell (or just "source" the new .cshrc)


External Library Build

  1. All builds must be done from the "psconfig" sub-directory
    %cd [tlsd]/psconfig
    
  2. Build the tools and libraries:
    %pschecklibs -build
    

Build Failure #1 in libjpeg:

#
# Error Text:
# ./libtool not found
#
# Error Cause:
# This is definitely an issue with the libjpeg build. There is absolutely no reason
# for this library build to be looking in its local directory for a system tool.
# The "./" needs to be removed from the tool call in the Makefile.
#
# However, instead of modifying the makefile, as we should, we'll just go ahead and
# put a link into the library directory.

  1. First, make sure that libtool is built:
    %pschecklibs -force libtool
    
  2. Check to see if there is a libtool in the jpeg-6b directory (there shouldn't be).
    %cd [tlsd]/extlibs/jpeg-6b/
    %ls -l libtool
    
  3. If it's not there, add the link to the built libtool:
    %ln -s [tlsd]/psconfig/default.darwin_x86/bin/libtool 
    

# Note: Sometimes, the "wrong" version of libtool (in /usr/bin/libtool) is seen. This is denoted by an
# error referring to an unrecognized command following '-' in --merge. This is also corrected by manually
# linking to the (psbuild) built version of libtool (wherever it ends up in your build)

  1. Continue with the build:
    %cd [tlsd]/psconfig
    %pschecklibs -build
    

Build Failure #2 in libcfitsio:

#
# Note: Does not occur on all builds:

  • Not seen w/ tags: ipp-20100525, ipp-20100602 on 2006 MBP
  • Seen w/ ipp-20100602 on 2008 MBP)

#
# Error Text:
# ld: duplicate symbol _tempfilename in fpackutil.o and fpack.o
# There are also a number of warnings regarding integer formats and the size of a (64-bit)
# pointer on MacOSX -- ignore these warnings for now.
#
# Error Cause:
# tempfilename is defined as a static character array in the fpack.h header. The abort_fpack
# function (in fpackutil.c) attempts to do some garbage collection on this static array, which
# is...."bad, mmmmmk?" Furthermore, there is no other reference to this global variable (there is a
# locally defined tempfilename in one of the other functions).
#

  1. Fix: Comment out/remove the header definition and the if-statement in abort_fpack:
  2. Re-build the cfitsio library manually:
    %cd [tlsd]/extlibs/cfitsio3100-p2/
    %configure
    %make clean
    %make shared all
    
  3. Continue with the build:
    %cd [tlsd]/psconfig/
    %pschecklibs -build
    
  4. Should succeed, but verify with:
    %pschecklibs
    


Perl Libraries Build

  1. This is an easy one (hopefully!):
    %pscheckperl -build
    
  2. Should succeed with no alterations (OMGWTFBBQ!!!)


IPP Build

  1. Start a clean, developer build.
    %psbuild -dev -clean
    

Build Failure #3: in Ohana

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# tlsd/Ohana/src/opihi/lib.data/svdcmp_bond_raw.c:15:47: error: malloc.h: No such file or directory
#
# Error Cause:
# malloc.h is obsolete on most new OSes.
#

  1. Comment out the #include of malloc.h in: [tlsd]/Ohana/src/opihi/lib.data/svdcmp_bond_raw.c
  2. ...and re-start the build:
    %psbuild -dev
    

Build Failure #4: in Nebulous/nebclient

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100602 and later)
#
# Error Text:
# You must have libtoolize installed to compile nebclient.
# Download the appropriate package for your distribution,
# or get the source tarball at http://ftp.gnu.org/gnu/libtool/
# problem building Nebulous/nebclient : failure in psautogen.
#
# Error Cause:
# Don't know what happens hare, but simply re-starting the build at Nebulous with the -rebuild
# flag seems to work. Probably a version conflict with the /usr/bin/libtool
#
# Note: the "trick" of re-starting the build is a good first attempt at "fixing"
# any build failure.

%psbuild -dev -rebuild -start Nebulous

Build Failure #5: in psLib

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# psFits.c: In function, psFitsOpen‚:
# psFits.c:155: warning: assignment makes pointer from integer without a cast
# psFits.c:214: warning: assignment makes pointer from integer without a cast
#
# Error Cause:
# This is a combination of a bad variable cast to a 64-bit pointer from a 32-bit int,
# and the flag set to treat warnings as errors. Mac OSX actually needs to be using the first
# part of this #if statement.
#
# Note: The psLib build is also issuing the link to the ipp config definition of:
# IPP_SOMETHING-OR-OTHER -- which can be a build failure later.
#

  1. Comment out the following:
    //#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
                strerror_r(thisErrno, errorBuf, MAX_STRING_LENGTH);
                errorMsg = errorBuf;
    //#else
    //            errorMsg = strerror_r(thisErrno, errorBuf, MAX_STRING_LENGTH);
    //#endif
    
  2. Same thing with the next one:
    //# if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
                    strerror_r (errno, errorBuf, 64);
                    errorMsg = errorBuf;
    //# else
    //                errorMsg = strerror_r (errno, errorBuf, 64);
    //# endif
    

# Technically, the correct fix is to set the POSIX_C_SOURCE=200112L and _XOPEN_SOURCE >= 600
# flags for the Darwin build.

  1. Continue with the build.
    %psbuild -dev -rebuild -start psLib
    

Build Failure #6: in psModules:

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# checking for psParseErrorCodes... missing
# configure: error: psParseErrorCodes is required
#
# Error Cause:
# The psLib build really mucks up where it places things. In this case it puts it in:
# [tlsd]/psLib/etc/pslib and [tlsd]/psLib/share/pslib.
#

  1. Quick fix: Put soft links from the right directory ([tlsd]/psconfig/default.darwin_x86/*) into the build directory.
  2. Long-term fix: Figure our where psLib does it's directory stupidity and fix it.
    %cd default.darwin_x86
    %mkdir etc
    %cd etc
    %ln -s [tlsd]/psLib/etc/* .
    %cd ..
    %cd share
    %ln -s [tlsd]/psLib/share/* .
    
  3. Continue with the build:
    %cd [tlsd]/psconfig
    %psbuild -dev -rebuild -start psLib
    

Build Failure #7: in psModules

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# psMetadata.c in function 'psMetadataPrint':
# psMetadata.c:1372: warning: format '%jd' expects type...
#
# Error Cause:
# Basically, the "treat warnings asserts" build flag is turned on, and the compiler
# has choked on an attempt to print a 64-bit field, using a "maxint"
# (which is larger than 64-bits on MacOSX) format string.
#

  1. In psMetadata.c, make the following changes:
    # Lines 1372 and 1487: change the format specifier: '%jd' to: '%qd'
    # Lines 1384 and 1459: change the format specifier: '%ju' to: '%qu'
    
  2. ...and re-start the build:
    %psbuild -dev -rebuild -start psModules
    

Build Failure #8: in psModules:

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# /usr/X11R6/include/X11/Xosdefs.h:145:1: error" "_DARWIN_C_SOURCE" redefined
#
# Error Cause:
# Yay for X11 ugliness!
# Maybe updating my X11 would help? It'll be on the to-do list.

  1. My ugly "hack" fix was to go into the Xosdefs.h header and bracket the redefinition with:
    #ifndef _DARWIN_C_SOURCE.
    ...
    #endif
    
  2. ...and re-start the build:
    %psbuild -dev -rebuild -start psModules
    

Build Failure #9: in psModules:

#
# Note: Does not occur on all builds (eg: not seen w/ tag: ipp-20100525 and later)
#
# Error Text:
# pmDark.c:354: warning: cast from pointer to integer of different size
#
# Error Cause:
# Trying to cast a 64-bit address into a 32-bit integer...

  1. Change the cast and the format string to support the 64-bit address pointer:
    ...
    sprintf (name, "%lx", (unsigned long) id);
    ...
    
  2. ...and re-start the build:
    %psbuild -dev -rebuild -start psModules
    

Build Failure #10: in extsrc/gpcsw:

#
# Error Text:
# bin/sh: ginstall: command not found
#
# Error Cause:
# Guess what? The ginstall tool is not installed, by default, on Mac OSX.

  1. In the file: [tlsd]/extsrc/gpcsw/gpcsrc/Make.Common
    • Change the line:
      INSTALL = ginstall
      
    • to read:
      INSTALL = install
      

1a. Alternatively, you can install the ginstall tool.

  1. ...and re-start the build:
    %psbuild -dev -rebuild -start extsrc/gpcsw
    

Build Success!!!

...
*** done with magic/remove ***
  1. ...and you're done! Have fun testing and reducing!