Category Archives: Coding and Development

Install VR Juggler on Ubuntu Linux – from packages!

Just a brief announcement on a broader, more Google-accessible venue: I’ve been creating and maintaining VR Juggler packages for Ubuntu in a PPA repository. If you’re on Lucid (10.04) or Maverick (10.10), you’re in luck: I have both 3.0 and 2.2 versions created, though at the moment you can’t have both of their dev packages installed simultaneously. I created them primarily for my own use and sanity, but I’m happy to share – getting Juggler to build and package nicely in both 32 and 64-bit was a bit of work.  They certainly won’t win awards for high-quality packages, but I’ve been using them for quite a while and they are easier to handle than a mess of locally-installed versions.

Here’s the Launchpad URL for more info:https://launchpad.net/~isu-vrac/+archive/vr-software

Just run these commands to add the source:

sudo add-apt-repository ppa:isu-vrac/vr-software
sudo apt-get update

(or add ppa:isu-vrac/vr-software to your Software Sources control panel)

Then, you can use your preferred package management tool to install: here’s the “install it all” packages in the Ubuntu Software Center, for example. (Once you have the source added, these links should also work: install VR Juggler 2.2 development packages or install VR Juggler 3.0 development packages)

VR Juggler in Ubuntu Software Center

Enjoy!

Keep Mac OS X from mangling your Lua code

If you write Lua, you might find yourself trying to type three dots in a row for a function with variable parameters. When doing this recently, I found that it was frustratingly being turned into an ellipse (the “three dots in one character” symbol) despite the fact that my text editor had all the auto-everything turned off.

It turns out that Mac OS X (at least 10.6, might be earlier too) can “helpfully” perform some MS Word-style autocorrections for you. I had a little difficulty finding where, so I thought I’d archive it in spiderable-space here. Here’s how to turn down the offer of help:

  • Open System Preferences, and choose the Language & Text item.

  • Choose the Text tab.
  • Uncheck all undesired corrections.

Building and Installing VR Juggler on Mac OS X

VR Juggler is an open-source virtual reality framework that is very cross-platform compatible.  However, that doesn’t mean it is necessarily easy to install on multiple platforms – there are some pitfalls.  Hopefully this post will help VR Juggler users get it going on their Mac computers.

Homebrew is a great replacement for MacPorts or Fink: it’s a system for installing Unix or Unixy packages on Mac OS X.  It tries to keep things simple and non-duplicated (unlike, for example, MacPorts…).  I’ve created package descriptions (“formulae”) for Brew to install VR Juggler 2.2.x or 3.0 prereleases on the Mac – just follow these steps.  If you’ve already used Homebrew, you can skip the first three steps.  Update instructions are at the bottom.

  • If you haven’t already, install XCode: there should be a somewhat out of date version on your OS X install CD, and you can get an updated version from Apple’s ADC.
  • Install homebrew system-wide in /usr/local – the latest instructions (from the homepage at http://github.com/mxcl/homebrew ) at time of post are:
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"

(If you want, you can install it elsewhere: I’ll refer you to the brew homepage and wiki for instructions on installing brew elsewhere, and you’ll have to change all instances of /usr/local in these instructions to your chosen install directory.)

  • Install git, update brew, and set it up as a git repo:
cd /usr/local
brew install git
brew update
  • If you’ve already used Homebrew, this is the place where you pick up in the instructions: add my repository as a remote, and merge it.
cd /usr/local
git remote add rpavlik http://github.com/rpavlik/homebrew.git
git fetch rpavlik
git merge rpavlik/master
  • Optional: Edit/create .bash_profile by running this command (or choosing Open Hidden with Fraise)
nano ~/.bash_profile

add these lines toward the top for brew’s sake.

# Mac Homebrew
export PATH=/usr/local/sbin:/usr/local/Library/Contributions/examples:$PATH
export PYTHONPATH="/usr/local/lib/python2.6/site-packages/:$PYTHONPATH"
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
# Bash completion scripts
if [ -f `brew --prefix`/etc/bash_completion ]; then
 . `brew --prefix`/etc/bash_completion
fi
  • Find out about possible issues with your install through a brew diagnostic command – you may want to act on its recommendations.
brew doctor
  • Install the latest CMake from cmake.org: when it asks where you want to install command line tools to, first run this in a terminal
mkdir -p /usr/local/Cellar/cmake/CMAKEVERSIONGOESHERE/bin
  • Then back in the cmake installer, type:
/usr/local/Cellar/cmake/CMAKEVERSIONGOESHERE/bin
  • Run this command to point brew to your CMake:
brew link cmake
  • Install any or all of these optional dependencies, if desired – it won’t hurt to install more than necessary, so I’d recommend installing all of them (you can put all the package names on the same brew install command)
brew install vrpn
brew install omniorb
brew install freealut
  • Install your desired version of VR Juggler: either 2.2.x or 3.0.x. Add “–HEAD” to the command to build the latest SVN from that branch instead of the latest release tarball, and add –with-debug if you also want the debug-enabled versions built [new enhancement courtesy of Brandon Newendorp – thanks!].
brew install vrjuggler-2.2
brew install vrjuggler-3.0
  • Go get a snack while this builds – it will take a while, especially if you haven’t installed any brew packages before (since it will compile the common dependencies like boost, etc)
  • When it’s done: you’ll have your desired VR Juggler installed to /usr/local – a message will tell you where the VRJConfig.app bundle is so that you can copy it to /Applications, if you like.
  • If you use OpenSceneGraph for your apps, you can also install it using Homebrew. You may first wish to run:
brew install collada

to install the COLLADA DOM so your osg build can read collada files.  In any case, run:

brew install openscenegraph

and go eat a meal – OSG is a large set of software so it takes a while.  On my MacBook (Santa Rosa/Late 2007), I believe it takes roughly an hour to build.  Don’t worry, Brew build in parallel when possible, so if you have a very fancy machine it will go quickly.  If you want to use the OpenSceneGraph as a framework, instead of “unix-style”, you’ll want to build the XCode projects included with the OpenSceneGraph source instead of using Homebrew.  (Both methods work, it’s just personal preference or potentially some corner cases.)

To update, just run:

brew upgrade

Once you’ve merged from my repository, you’ll have a slightly-patched version of brew that first updates from my repository before updating from the upstream repo.  This makes it so that I have a chance to fix any merge conflicts pre-emptively so you don’t run into them.  If you get a merge conflict, running this command will undo the attempted merge and any uncommitted changes in your homebrew repository (which is safe as long as you aren’t making your own formulas without committing them).

cd /usr/local
git reset --hard

If these instructions aren’t quite clear, please contact me and let me know how I can clarify them – I only have one Mac so I rarely start from scratch setting up a development environment.

[EDIT: 8 Sept 2010 – Fixed the path for installing CMake links, add brew doctor step, add note about OSG as a framework]

[EDIT: 8 Sept 2010 – Add notes about .bash_profile]

[EDIT: 28 Jan 2011 – Made the CMake section clearer and not version-specific, added info about –with-debug flag for VR Juggler formulas]

Git version control, Xcode, and Linux

Git and I

Within the last year, I’ve started to use Git (a distributed version control system) to manage changes to my personal and academic projects.  If you’ve used SVN or CVS before, the basic concept of storing multiple versions and committing changes is similar, but it’s otherwise a bit different: with Git, branching and merging is cheap (time-wise) and very easy, so you’re encouraged to branch and merge often.  This fosters a healthy “keep the master (trunk) branch stable” habit while you continue development of features, each in their own branch.  Additionally, Git has a concept of “staging” your changes – it doesn’t commit all of your modifications by default, so you can make sure that each commit is “atomic” – that it accomplishes only one thing.  Even when doing weekly class assignments now, I use Git as a way to track my progress, incentivize rapid progress (committing changes gives a rush of energy), and store working versions without making many messy copies of my source directory.  Read on for what I’ve learned and how to get started! Continue reading