PBRT and Mac OS X 10.4.10

For a computer graphics class, I needed to build PBRT. Being a Mac guy, I decided to build it for Mac OS X. In addition, I wanted to make sure I was using the latest version of at least PBRT (it's at 1.0.3 as of this writing). I also wanted to use Fink as much as possible for any dependencies.

Getting the PBRT source code

To do this, you will at least need to grab the source code for v1.0.3 from PBRT's downloads page. If you want to try and of the sample scenes, however, you will need to grab them from the CD that came with the book. After unpacking it, I moved the new folder to ~/pbrt. If you want it somewhere else, make sure to change the PBRT_SEARCHPATH environmental variable in the next step accordingly.

Setting the environmental variables

In Mac OS X, I believe that if a .profile file exists in your user folder, any .bashrc file is ignored. It could also be that .bashrc is just plain ignored. In any case, Bash in Mac OS X likes using .profile, so putting this at the top of my file worked.

export PBRT_SEARCHPATH=$HOME/pbrt/bin
export PATH=${PATH}:/usr/local/bin:$HOME/bin:$PBRT_SEARCHPATH

If you have a Terminal window open, type exit and open a new window. This will ensure that your Terminal has these changes.

Getting the necessary Fink packages

I should point out from the start that I use unstable with Fink. OpenEXR is available in both stable and unstable, but we are talking a difference of version 1.2.2 and 1.4.0 as of right now. You can install the necessary packages using the command

fink install openexr ccache

in the Terminal. There is a good possibility other packages are needed. If something comes up, drop a comment and I will update this as necessary.

Examining GCC

Another goal when I started this was to use the latest version of gcc as provided by Apple (you could also try the latest version of gcc as provided by Fink unstable, if you would like). On my computer, typing gcc --version provides

powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This will do fine--nothing special needs to be done.

Changing the Makefile

I am assuming that you have the default installation location of /sw for Fink (and if you don't, take it from someone who fought it for close to four years--make a symbolic link to /sw at least. It's not worth the pain.) The only lines necessary to change are the following three:

EXRINCLUDE=-I/usr/local/include/OpenEXR
EXRLIBDIR=-L/usr/local/lib
EXRLIBS=$(EXRLIBDIR) -Bstatic -lIex -lIlmImf -lImath -lIex -lHalf -Bdynamic -lz

should become

EXRINCLUDE=-I/sw/include/OpenEXR
EXRLIBDIR=-L/sw/lib
EXRLIBS=$(EXRLIBDIR) -Bstatic -lIex -lIlmImf -lImath -lIex -lHalf -lIlmThread -Bdynamic -lz

For reasons which I are probably not very interesting, they forgot to include the IlmThread library. The last line there adds it.

Finishing the job

At this point, all there is to do is to type make.

Comments

Popular posts from this blog

Xcode 3 language specification changes

Redux on iPhone and iPod Touch, 802.1X and LEAP

iPhone and iPod Touch, 802.1X and LEAP