How to get VTerrain running on Mac OS X.

NOTE: I'm in the process of slowly updating these instructions... reader beware... (March 22, 2007). It's going to take me a few days.

 

Document Last Modified: Fri Feb 24 16:19:05 CST 2006

These instructions are a guide for compiling VTerrain on OS X. VTerrain is compiling well on OS X provided all the necessary third-party libraries are installed. The makefiles that come with VTerrain support building on OS X via the command line and should not require much, if any, modification. If you have your third-party libraries installed in aa non-standard place, you will need to override the values in the Makefiles. The simplest way to do this is to place the overrides in the file ~/.vtp-user.defs.

Note: Instructions were completed using Mac OS X 10.4.9 (Tiger) with the latest version of the developer tools (XCode 2.4). The build instructions are based on the information provided in the general unix build instructions on the VTerrain website. If you want to check for the latest version numbers for third-party libraries, you should check the unix build instruction page rather than this page. Finally, the build was based on the VTerrain version in CVS.

I'm in the process of setting up VTP for use with Xcode. This should make compiling and installation a bit simpler as we can remove the dependence on the Makefiles. Also, I'll be able to produce a Universal binary out of the compilation process.

Build Instructions

VTP builds straight up on OS X, but requires a few things before this will work. Most of the steps involve installing third party libraries.

Required Third-Party Libraries

The following libraries must be installed.
  1. Install Fink
    The Fink project makes a very large set of Unix Open Source projects available for Mac OS X. Follow the instructions off the Fink webpage.

    Once you have Fink installed, you can install the following four packages: libxml2, netcdf, libpng, libwww. The "-b" options forces a binary install rather than an install from source.

    fink -b install libxml2
    fink -b install netcdf
    fink -b install libpng3
    fink -b install libjpeg-bin
    fink -b install libjpeg
    fink -b install libtiff

    // fink -b install libwww // ???
    fink -b install freetype
    fink -b install curl curl-dev
    // fink -b install curl-shlibs // rm
    // fink -b install curl-dev // rm

    Fink, by default, installs all of it's libraries in /sw. You will eventually need to modify a VTerrain user preference file so the Makefiles will look in /sw/include and /sw/lib.

    The fink version information from my system:

    Package manager version: 0.25.3
    Distribution version: 0.8.1.rsync i386
  2. Install Mini CLOD
    The Mini library can be downloaded from the link off the General Unix Build Instructions page. The recommended version is 6.83a.

    Once downloaded, the following commands should compile the library and place the appropriate header files and libraries in /usr/local. These instructions copy all the headers to the include directory and it may be possible to install fewer header files.

    ./build.sh
    sudo cp libMini.a /usr/local/lib sudo cp *.h /usr/local/include sudo cp *.hpp /usr/local/include sudo ranlib /usr/local/lib/libMini.a

    You can build the Mini example if you want to see Mini working on your system. This step isn't necessary for using VTerrain.

    ./build.sh example
    ./example
  3. Install GDAL

    The GDAL library can be downloaded from the link off the VTerrain Libraries page.

    According to the GDAL website, GDAL is now available for Mac OS X via the Fink project. However, I haven't tried using it yet.

    cd gdal-1.4.0
    LDFLAGS=-L/sw/lib CFLAGS=-I/sw/include CXXFLAGS=-I/sw/include ./configure --prefix=/usr/local --without-python --with-macosx-framework
    make
    sudo make install

    I've built the GDAL libraries without Python and haven't noticed problems. You can now have GDAL build the Mac OS X Frameworks, which will be istalled into the /Library/Frameworks directory.

  4. Install wxWidgets

    wxWidgets provides a MacOS distribution off their download page. The version of wxWindows used for this build is 2.6.2. Additional information about wxWidgets and OS X can be found at the following links:

    I've been using the following compile line to compile wxWidgets:

    LDFLAGS=-L/sw/lib CFLAGS=-I/sw/include CXXFLAGS=-I/sw/include ./configure --disable-shared --with-mac --with-opengl --prefix=/usr/local
    make
    sudo make install

  5. Install the PROJ library

    Grab the PROJ library from http://www.remotesensing.org/proj/. The version of PROJ used for this build is 4.4.9.

    ./configure --prefix=/usr/local
    make
    sudo make install
  6. Install OpenSceneGraph

    Note that with OS X 10.4.3, Apple has substantially updated the OpenGL drivers. You should completely recompile the OpenSceneGraph libraries.

    OpenSceneGraph works great on Mac OS X. Grab the 1.0 stable distribution, compile OpenThreads, Producer, and OpenSceneGraph libraries. Before you install OpenSceneGraph, you'll also need X11 and it's development libraries, as provided by Apple. You will need to grab the OpenSceneGraph-Data files to execute all the provided examples.

    It is now possible to download a binary distribution of OSG for Mac OS X. . However, I have not tried that distribution with VTerrain.

    Before you compile OpenSceneGraph, edit the file OpenSceneGraph/include/osg/Matrix and change the line #define OSG_USE_DOUBLE_MATRICES 1 to #undef OSG_USE_DOUBLE_MATRICES. This forces OpenSceneGraph to use float matrices. For more information on this topic, search the OpenSceneGraph and VTerrain mailing lists.

    cd OSG_OP_OT-1.0
    cd OpenThreads
    make
    sudo make install
    cd ../Producer
    make
    sudo make install
    cd ../OpenSceneGraph
    COMPILE_EXAMPLES=yes make
    sudo make install

    The above commands will place the OpenSceneGraph and related libraries in /usr/local. If you want to change the installation location, you will have to edit Make/makedefs. The OpenSceneGraph libraries compile against AGL (OpenGL from the Carbon Framework). If you want to compile against X11, you will need to examine the Make/makedefs file. You will also need to set the following environment variables, especially if OSG is placed somewhere other than /usr/local:

    export OSG_FILE_PATH=/usr/local/data/OpenSceneGraph-Data
    export DYLD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/osgPlugins

    and execute the programs installed in /usr/local/share/OpenSceneGraph/bin.

  7. Install QuikGrid

    As of this build, I haven't attempted to build QuikGrid on OS X. Edit vtdata/config_vtdata.h to remove support for QuikGrid.

Building VTerrain

Download version 060210 of VTerrain after installing the above libraries, and then edit (or create) a file ~/.vtp-user.defs to override the locations where you installed the software. For instance,

override LOCALBASE = /usr/local
override OSG_BASE = /usr/local
override WX_DIR = /usr/local

Unless you've installed a few other libraries, you will need to edit TerrainSDK/vtdata/config_vtdata.h and undefine (or set to 0) the variables representing the libraries you do not have installed. At the moment, I have disabled SUPPORT_QUIKGRID and SUPPORT_UNZIP in the vtdata/config_vtdata.h file. At some point, I'll work to get these added.

For Release 060210, you will need to make two small changes to the source to get VTP to compile.

  1. On lines 44 and 45 of TerrainSDK/vtlib/core/FelkelComponents.cpp, change the abs(...) function calls to fabs(...). My copy of this file is here.
  2. On line 206 of the file Make.defs, place the following string "-lcurl -lbz2" right before "-lz". My Make.defs is here.

You should be then be able to type "make" and have VTerrain build. There may or may not be small issues with the CVS version.

Pre-Built Packages

Note: This sub-section is outdated. I'll take care of updating this shortly. The dist provided below is from a previous release.

I am currently providing a pre-compiled tarball containing the third party libraries, as well as OS X Frameworks and Applications for VTerrain. The latest version of these build can be located at the following URL:

 http://www.d.umn.edu/~willemsn/vtpdist/
README.txt - http://www.d.umn.edu/~willemsn/vtpdist/README.txt

Current Status

All the apps work for the most part. There are still various bugs, so let me know if you run into them and I'll try to find fixes. Here are some screen shots:

ScreenShot - VTBuilder on OS X
ScreenShot - VTBuilder on OS X, Layer Dialog
ScreenShot - The Mexican Mountain dataset from the San Rafael Swell (Utah)
ScreenShot
- VTBuilder with two elevation datasets from Little Cottonwood Canyon, Salt Lake City, UT
ScreenShot - glutSimple running with the crater BT file - it says "VTBuilder" in the application window because I'm using the same property list as VTBuilder at the moment
ScreenShot - Enviro running with the Utah Dromedary Quad. The big peak in the window is the Pfeifferhorn.

Known (or Discovered) Issues

A couple of issues exist with FelkelComponents.h (change abs to fabs).


If you have questions, please email me [ willemsn at d umn edu ].