wiki:BuildMacOSX

Building OpenSG 1.8 on Mac OS 10.4 (Tiger)

  1. Install Xcode. Xcode is available on the MacOS X Install DVD, or for free download from the Apple web site. (You probably have it already anyway, since you are a developer ;-) )
  1. Install the image libs for JPEG, PNG, and TIFF. You can do that either via Fink (http://fink.sf.net/) or just from their respective tar balls (doing the usual "./configure && make && sudo make install" mantra). Either should work just fine. (The latter might have the advantage that OpenSG's build system will find them right away, because that way installs the libs in /usr/local .)
  1. Download the OpenSG source code tar ball und unpack it, and go into the OpenSG directory.
  1. Enter the following commands:
./configure --enable-glut --enable-tif --enable-jpg --enable-png

make

sudo make install

This will build the debug libraries and install them in /usr/local/lib/dbg, while the header files go in /usr/local/include/OpenSG.

(If you don't have an administrator password, you should specify the --prefix option with ./configure [if your account is the only one on the machine, then your password is the administrator password ;-) ])

  1. In order to build the optimized libraries, you do:
cd Builds/powerpc-apple-darwin-g++

make

sudo make install

Note: compilation can take a few hours. ;-)

As of this writing (Jul 2007), there is a little bug in the installation procedure on the Mac, which does not set the permissions correctly when installing as root (using, e.g., 'sudo'), so you have to change them manually like so:

sudo chmod a+rx /usr/local/lib/{dbg,opt}/*

Finally, in order to be able to actually run a program (e.g., one of the tutorials), you have to add the library path to DYLD_LIBRARY_PATH:

setenv DYLD_LIBRARY_PATH $(DYLD_LIBRARY_PATH):/usr/local/lib/opt

or just

setenv DYLD_LIBRARY_PATH .:/usr/local/lib/opt

Building OpenSG 1.x from CVS on Mac OS X 10.3 Panther or 10.4 Tiger

  1. Install Xcode. Xcode is available on the MacOS X Install DVD, or for free download from the Apple web site.
  1. To be able to load textures from JPEG-, JPEG2000-, PNG- and TIFF-Files, you have to install the respective libraries (libjpeg from http://www.ijg.org/, JasPer from http://www.ece.uvic.ca/~mdadams/jasper/, libpng from http://www.libpng.org/ and libtiff from http://www.libtiff.org/). I strongly recommend installing these libraries using the Fink package manager. Fink is available for free download from http://fink.sf.net/. You have to download different versions of Fink depending on the MacOS X version you are using, so make sure that you get the right one. Follow the instructions on the Fink download page to install the package manager.

After installing the Fink package manager, you have to install the packages for the libraries. I recommend using the “Fink Commander” GUI application included in the Fink disk image. Install the following packages: “libjpeg”, “libjasper1”, “libpng3” and “libtiff”. There are packages with similar names, make sure that you fetch the right ones! You have the choice between installing binary (precompiled) versions and versions from source – both are working, but I recommend installing the binary versions, because it takes less time.

  1. Start the “Terminal” application. It is located in “/Applications/Utilities/?”. The OpenSG build system is based on Unix tools, so you have to work on the command line. Whenever this document tells you to enter a command, do it in the Terminal window!
  1. Download OpenSG from the CVS. When downloading OpenSG for the first time, you have to enter the following commands (they create a new directory called “OpenSG” in the current directory and download the OpenSG source code into that directory):
cvs -d:pserver:anonymous@opensg.cvs.sourceforge.net:/cvsroot/opensg login

cvs -z3 -d:pserver:anonymous@opensg.cvs.sourceforge.net:/cvsroot/opensg co -P OpenSG

When prompted for a password, simply press “Return”.

When you need to update your local version of OpenSG with the current version in the CVS later on, you simply go into the OpenSG root directory and enter the following command:

cvs -z3 update -d -P

  1. Now you have to configure OpenSG. I recommend creating a special script file, because you have to configure OpenSG every once in a while when a new directory with OpenSG code has been checked in. For example, my script file looks like this (it is named “osgconf” and located in the OpenSG root directory):
export JPGDIR=/sw

export JASPERDIR=/sw

export PNGDIR=/sw

export TIFDIR=/sw

./configure --prefix=BUILD --enable-gif --with-jpg=$JPEGDIR --with-jasper=$JASPERDIR --with-tif=$TIFDIR --with-png=$PNGDIR --with-glut

Create this script with a text editor (e.g. “TextEdit?” in the “/Applications/” folder, but do not forget to save it as a plain text file), make it executable, and execute it:

chmod u+x osgconf

./osgconf

  1. Go into the directory “OpenSG/Builds/powerpc-apple-darwin-g++” (on PowerPC-Macs) or “OpenSG/Builds/i386-apple-darwin-g++” (on Intel-Macs) and enter the following commands:
make opt

make install

The first of these commands compiles a release/optimized version of OpenSG. The second installs the OpenSG headers into “OpenSG\Builds\???-apple-darwin-g++\include” and the libraries into “OpenSG\Builds\???-apple-darwin-g++\lib\opt”.

You also have to enter these commands everytime you change anything in the OpenSG source code, or when you update the source code from the CVS. In this case you should call “make update” instead of “make install”, because “make update” only copies the changed header files to the “Builds” directory. This is much faster, and in many cases it prevents a complete recompilation of your own code based on OpenSG.

Last modified 7 years ago Last modified on 01/17/10 01:11:44