Tuesday, August 25, 2009

Compiling Snowglobe on MacOS-X

Downloading and compiling the Snowglobe source isn't supposed to be that big of a deal. And for the most part it's not, but I figured I would blog my experiences anyway. I've been hitting my head against the wall for a while on Snowglobe; it's not difficult, it's just occasionally under-documented. 

So you might think the first step would be to check out the Snowglobe source and start compiling. Not so fast. Check to see if you have the right tools first. If you look on the Compiling the Viewer (Mac OS X) page, it'll give you a list of things to check. First, check to see that XCode is installed. I'm building on an intel Mac running 10.5.8. At the time i'm writing this, XCode 3.0 is the most recent version. You can download it from Apple at http://developer.apple.com/technology/Xcode.html . You'll also want to check your version of cmake is recent. I ran `cmake --version` and was told i have "cmake version 2.6-patch 4". The wiki page says you're supposed to have 2.6.2, but I like to live dangerously. You can go to http://www.cmake.org/cmake/resources/software.html to download the latest copy. They even put together a .dmg image with an installer. nice!

Next I checked out the source from the SVN repository with the command:

svn co https://svn.secondlife.com/svn/linden/projects/2009/snowglobe/trunk snowglobe


It might ask you a question about the server certificate; I was a complete fool and just hit the 'p' key to accept the cert permanently.

Now that you've checked out the source, you can get the libraries needed to compile. Fortunately there's a script for this. Change directories to the "snowglobe" directory the checkout command created, then execute the command:

./scripts/public_fetch_tarballs.py

Depending on your network, this can take a while.

But wait, some libraries can't be distributed by Linden. The process is documented at http://wiki.secondlife.com/wiki/Compiling_the_viewer_(Mac_OS_X)#Installing_Proprietary_Libraries , but the exact sequence of commands seems to be for the previous viewer (not Snowglobe.) So, I went to the FMOD Site, downloaded version 3.75 of FMOD (you don't want the latest version, you have to scroll down 'til you see the "FMOD 3 Programmers API" heading. Look closely at the table below it and you should see the MacOS-X download button. My browser is setup to download and extract files into the ~/Downloads directory, I cd'd into the snowglobe directory and used the following commands to put FMOD in the right place:

mkdir -p libraries/include
mkdir -p libraries/universal-darwin/lib_debug
mkdir -p libraries/universal-darwin/lib_release
cp -p ~/Downloads/fmodapi375mac/api/inc/*.h libraries/include
lipo -create ~/Downloads/fmodapi375mac/api/lib/libfmod.a ~/Downloads/fmodapi375mac/api/lib/libfmodx86.a -output libraries/universal-darwin/lib_debug/libfmod.a
touch -r ~/Downloads/fmodapi375mac/api/lib/libfmodx86.a libraries/universal-darwin/lib_debug/libfmod.a
cp -p libraries/universal-darwin/lib_debug/libfmod.a libraries/universal-darwin/lib_release/libfmod.a

Now, I'm kind of old school, so I like to do build things on the command line. So cd'd into the indra directory and used the following command to configure things:

./develop.py

Then I used this command to kick off the build:

./develop.py build

And then I went to grab a drink at the corner bar. When I came back, I found a copy of the Snowglobe application in the "build-darwin-i386/newview/RelWithDebInfo" directory. I'm a command line kinda joe, so i launched it with the command:

./build-darwin-i386/newview/RelWithDebInfo/Snowglobe.app/Contents/MacOS/Snowglobe --grid agni --channel "Arrogant Cyberstar"

And have been happy ever since.