How to create the right build environment to compile UltraScan?-II in Mac OSX native Aqua environment such that the resulting binaries will run both on Mac PPC and Mac Intel i386 using a G4 Macintosh architecture. All instructions assume that the qt-dependent libraries and programs will be built as the user "us2" in /Users/us2.

  • Upgrade a G4 to Mac OSX 10.5.8, the highest level of OSX that can be installed on a G4.
  • Download XCode from the Mac developer site for 10.5.8 (After logging into the developer site search for 'Xcode 3.1.2' in the upper left search bar). This version of XCode contains gcc 4.0.1 and 4.2.1 (set default to 4.2.1 in /usr/bin, gcc is a dynamic link)
  • download mysql 5.1.42 from
  • extract in /usr/local/src and change ownership to user to avoid having to use sudo for everything

sudo chown -R /usr/local/src/

  • apply the following patch in the /usr/local/src/mysql-5.1.42 directory: modify line 102 of file depcomp:
    old: -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg"
    new: -c) set fnord "$@" "$tmpdepfile" "$arg"
  • Now configure MySQL with the following line:
    ./configure CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" CXXFLAGS="-arch i386 -arch ppc" --prefix=/usr/local
    Build with "make" && "make install" to install in /usr/local/

Configuration of Qt 3.3.8:

  • set up the environment in /etc/profile with sudo:
    export ULTRASCAN=/Applications/UltraScanII
    export PATH=$PATH:$ULTRASCAN/bin
    if [ -x /usr/libexec/path_helper ]; then
            eval `/usr/libexec/path_helper -s`
    if [ "${BASH-no}" != "no" ]; then
            [ -r /etc/bashrc ] && . /etc/bashrc
    export PS1="[\u@\h \W]\\$ "
    export QTDIR=/Users/us2/qt
    export QWTDIR=/Users/us2/qwt
    export QWT3DDIR=/Users/us2/qwtplot3d
    export PATH=$PATH:$QTDIR/bin
    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$QTDIR/lib:/usr/local/mysql/lib:$QWTDIR/lib:QWT3DDIR/lib
    export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/mysql/include:$QTDIR/include:$QWTDIR/include:$QWT3DDIR/include
  • configure and build the qt library with this string:
    /Users/us2/qt/configure -thread -qt-sql-mysql -qt-gif -stl -largefile -platform macx-g++ -dlopen-opengl
  • confirm that the build lines include the string "-arch i386 -arch ppc"
  • next, build the ultrascan version of qwt (available here: and qwtplot3d (available here:
  • use svn to check out a copy of UltraScan-II:
    svn co svn:// ultrascan2
    (and: svn update to update for new versions)
  • go to /Users/us2/ultrascan2/develop and build the library with:
  • if need be, create the start-up applications folder (assuming the above downloaded to /Users/us2/Downloads).
    cd /Applications
    tar -xvzf /Users/us2/Downloads/UltraScanII-mac.tar.gz
  • copy some needed scripts to your work directory
    rsync -av /Applications/UltraScanII/bin/* /Users/us2/ultrascan2/bin
  • accumulate supporting libraries in the work directory
    cd /Users/us2
    rsync -av qt/lib/libqt-mt*.dylib ultrascan2/lib
    rsync -av qwt/lib/libqwt*.dylib ultrascan2/lib
    rsync -av qwtplot3d/lib/libqwt*dylib ultrascan2/lib
  • fix internal paths to libraries
  • update the /Applications bin and lib directories with latest builds
    cd /Users/us2/ultrascan2
    rsync -av lib/lib*.*.*.*.dylib /Applications/UltraScanII/lib
    rsync -av bin/*.app /Applications/UltraScanII/bin
  • assign icons to the UltraScanII folder and the bin/ application by copying existing icons using right-mouse-button click Get Info to copy and paste the icon in the upper left of the Info window.


The installation package for Ultrascan II on the Mac is a compressed disk image ( file. The disk image contains a Read Me text file and the UltraScanII folder to be copied to the /Applications folder.

It is produced in the following way.

  • Create the DMG by clicking on New Image in the upper tool bar.
  • Enter a name such as "ultrascan-9.9-1763-MacOSX-10.5" for the Save As: field.
  • Enter something like "UltraScan 9.9 Revision 1763" for the Name: field.
  • Insure that "Desktop" is the Where: choice.
  • Select "177" as the Size: value.
  • Leave other fields as defaulted and click on the Create button.
  • Once the image has been created, double-click on it to open a Finder window to copy to.
  • Open a new Finder window (click on the Desktop, then release on File -> New Finder Window).
  • In this new window, navigate to /Applications/UltraScanII/
  • Drag and drop Read Me First to the disk image window.
  • Back off to /Applications and drag the UltraScanII folder to the disk image window.
  • From the Desktop or a Finder window at /Users/us2/Desktop, right-mouse-button click on the disk image and release on Eject.
  • Right-mouse-button click on the Desktop .dmg file and release on Compress.
  • Drag the .dmg file (but not the file) to the Trash.
  • Copy the file you have created to the ultrascan2 download site and edit the download.php there accordingly.
Last modified 6 years ago Last modified on Sep 19, 2012 7:39:35 PM