Note:

Please read the license agreement on this page before making use of anything you find here. Download, use and/or distribution in any form of the things you find here constitutes agreement to the conditions of this license.

 

Player/Stage on Mac OS X Snow Leopard

If you've found your way to this page, chances are you already know what a royal pain in the ass it is to get Player/Stage software running on a Mac.  The Macports bundles are broken, so you build from source.  The build fails, so you scrape together all the possible dependencies, and half of them are broken, too.  The install docs for your particular flavors of Player/Stage/OS X are either horribly archaic or entirely fictional.  Follow this guide and you will be programming simulated 2.5D robots in no time:

ps

I had to fix a lot of things while installing, and I'm not entirely sure what made it work and what was extraneous, so I'm just going to put every little step up here (out of superstition more than anything else).

NOTE:  This how-to is published for informational/instructional purposes ONLY, and has been tested on Player 3.0.2 / Stage 3.2.2 running on Snow Leopard 10.6.4.  I assume NO responsibility for its accuracy in later versions of Player/Stage or OS X (although it should work fine on later versions of OS X as far as I can tell), and I offer NO guarantee that it will work for the versions listed above either.  I do hope it's helpful to you though.

1)   Setup, etc.

I started with a fresh install of Fink, and chose to use only 64-bit packages during the configuration of Fink (You will also need XCode for Fink to work, which is found on the App Store or on the Mac OS X Developer Website)

Next, you need to edit the /sw/etc/fink.conf file to include unstable packages in the package Tree. It's read only, so do:

          sudo chmod 755 /sw/etc/fink.conf

Then, using your favorite editor (emacs gave me problems for some reason so I used nano), change the line:

          Trees: local/main stable/main stable/crypto
to:
          Trees: local/main stable/main stable/crypto unstable/main unstable/

Save, exit, and run Fink's selfupdate and index commands.


2) Dependencies!

You need a ton. Here's what I installed before installing P/S:

(Note: Some of these packages may have different names. If one of them is wrong and Fink cannot install it, figure out the correct name of the package to install by using "fink list | grep <packagename>", i.e. if fltk-x11 is not available use "fink list | grep fltk" and fink will show you the available fltk packages.)

For Player:

fink install cmake
fink install gtk+2
fink install gtk+2-dev
fink install gsl
fink install libhowl-bin
fink install libhowl-dev
fink install libhowl-shlibs
fink install ffmpeg
fink install ffmpeg-dev
fink install libgnomecanvas2
fink install libgnomecanvas2-dev

For Stage:

fink install fltk-x11
fink install pkgconfig

NOTE: Many of these packages (especially cmake and gtk+2) have a ton of dependencies themselves, so be prepared for this step to take a couple hours.

PlayerStage also depends on OpenCV, which is not available through Fink or Macports. Install as follows:

Dependencies:
* libjpeg
* libpng14
* libtiff
* glib2-dev
* pango1-xft2-ft219-dev
* atk1
(all can be installed using Fink)

Get the tarball from external link: OpenCV 2.1.0

(Get the .tar.bz2 package, not the .zip package)

Extract using:

          tar -xjvf OpenCV-2.1.0.tar.bz2 && cd OpenCV-2.1.0

Cmake has default paths for the include and lib files which are wrong on OS X with Fink, so change them now with:

          export CMAKE_INCLUDE_PATH=/sw/include
          export CMAKE_LIBRARY_PATH=/sw/lib

(Assuming you installed Fink in the default location /sw)

You may want to double check the values of these paths before building player and stage, to make sure they include the above directories.

Now you're ready to build and install:

          mkdir build && cd build
          cmake ../
          make
          sudo make install

(Note: When using CMake, you can specify install options, such as the install path, using the 'ccmake .' command first. Shouldn't be necessary, but for control freaks like me, it makes us feel better to know that we can.)


3) Installing Player:

Download the tarball from:  Player 3.0.2
You may as well get the Stage package from here too while you're at it:  Stage 3.2.2

Player installed pretty easily. Go to the directory you saved the tarball in and do:

          tar -xvf player-3.0.2.tar.gz && cd player-3.0.2
          mkdir build && cd build
          cmake ../
          make
          sudo make install

And now you have Player.


4) Installing Stage:

This is the tricky part. Extract the Stage package like you did for player, and cd into the folder. First, you need to make sure pkgconfig can find your installed player. If you didn't specify an install path, it will be:

           export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Now you need to patch the source code because there is a linking error during the build. Download the patch from:
Stage 3.2.2 Patch File
and move it into your Stage source directory. Next, run the command:

          patch -p0 < stage-3.2.2.fixdso.patch

from the source directory, and it should work.

Lastly, cd into the libstage directory in the Stage source code and edit the main.cc program as follows:

Fl::run() is undefined during the build, which causes a make error, so at the top of main.cc add the header:

#include <FL/Fl.H>

to the list of headers. It should now read:

#include <getopt.h>
#include <FL/Fl.H>
#include "stage.hh"
#include "config.h"
using namespace Stg;

at the top of main.cc. This should take care of it.
Add the same header to p_driver.cc under the libstageplugin directory.

All that's left is to install. Make sure you are in the main Stage source code directory (not libstage) and do:

          cmake .

Next, use 'ccmake .' to configre the install. Make sure that the category LINK_FLTK_STATICALLY is ON. Hit c to configure, then e to exit the configure screen. Finally, hit g to compile and exit. (NOTE: The static linking MAY have been superfluous, since the patch ideally accomplishes the same thing. If you still have trouble installing, try again without using 'ccmake'.)

          make
          sudo make install

And you're done! If this doesn't work let me know. I may have missed something, or mistyped, or forgotten a step, or just gotten lucky. Feel free to email me any issues (copy error messages in and tell me exactly what you were trying to do in this step) - my email is john@boinkrobotics.com. If I forgot a step or something, chances are I'll remember it when I see the error message.

Enjoy your robots!



P.S.  If you want to get Gazebo running on a Mac, good luck!  IF you manage to do it, and IF you escape this process with enough sanity to string together an intelligible series of sentences describing just how you managed to do it, please email me and I shall post it here (giving you full credit, of course). Please include instructions for building the ODE and OGRE frameworks as well!