30 aprile 2012
iCub simulator on Mac OS X Lion: the definitive (?) tutorial
This tutorial will describe the various steps required to install YARP and the iCub robot simulator on a 64-bit computer running Mac OS X Lion.
Install GCC and homebrew
- Make sure your Mac is running the latest version of OS X Lion (currently 10.7.3)
- Install Xcode from the Mac App Store (the current version is 4.3.2)
- Open Xcode and install the Command Line Tools, going to Preferences (cmd+,) -> Downloads -> Command Line Tools -> Install
- Download and install homebrew issuing the following command in a Terminal window:
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" - Run
brew doctorto check whether homebrew is fully functioning already. If not, please follow the instructions provided (most of the time you will simply have to launch a command likesudo xcode-select -switch /Applications/Xcode.app/Contents/Developer)
Install YARP via homebrew
- Run the
brew install yarpcommand (other than YARP this will also automatically install several dependencies as ACE and CMake)
Compile and install ODE from the sources
- Download the ODE sources (version 0.12) and extract the archive somewhere on your computer (we will refer to this location as $ODE_DIR)
- Download premake4 and unzip the binary into $ODE_DIR/build
- Download Code::Blocks and install it on your machine
- Enter $ODE_DIR (
cd $ODE_DIR) and generate a Code::Blocks project for ODE using the command./premake4 --platform=x64 --os=macosx --no-alloca --all-collis-libs --cc=gcc codeblocks - Open $ODE_DIR/build/ode.cdb in Code::Blocks, select as build target “ReleaseDoubleLib|x64” and build everything
- Copy the $ODE_DIR/include/ode folder to /usr/local/include/
- Rename $ODE_DIR/libode_double.a to $ODE_DIR/libode.a and copy it to /usr/local/lib/
Compile and install SDL from the sources
- Download the SDL sources (version 1.2.15), extract the archive somewhere on your computer (we will refer to this location as $SDL_DIR)
- Install the autoconf tools running:
brew install autoconf - Pre-configure, compile and install SDL running the following commands in sequence:
cd $SDL_DIR./autogen.sh./configure --disable-assemblymakesudo make install- Copy SDLMain.h and SDLMain.m from $SDL_DIR/Xcode/TemplatesForXcodeSnowLeopard/SDL Application/ to /usr/local/include/SDL/
Install the iCub simulator
- Install the Gtk+ C++ interface gtkmm running:
brew install gtkmm - Create a directory on your machine which will host the sources of the iCub simulator (we will refer to this location as $ICUB_REPOSITORY)
- Enter $ICUB_REPOSITORY and download the latest version of the iCub simulator via SVN, running the command:
#svn co https://robotcub.svn.sourceforge.net/svnroot/robotcub/trunk/iCub - Setup some environment variables adding the following lines to your ~/.profile file (replace $ICUB_REPOSITORY with the path of the directory created two steps above):
export ICUB_ROOT="$ICUB_REPOSITORY/iCub"export ICUB_DIR="$ICUB_REPOSITORY/iCub/main/build"- Close and re-open the Terminal for the changes to the environment variables to be applied;
- Run:
mkdir $ICUB_DIR - Enter $ICUB_DIR (
cd $ICUB_DIR) and run:ccmake .. - Configure the project (‘c‘ key) a few times, setting CMAKE_BUILD_TYPE to “Release” and USE_ODE_DOUBLE to “ON“. When it becomes available, press ‘g‘ to generate a Makefile and exit CMake
- Compile the iCub simulator running the
makecommand and install it with:sudo make install - Install the support applications running:
sudo make install_applications - Enjoy! :)
Troubleshooting (compile and install YARP from the sources)
Many things might go wrong following the procedure outlined in this tutorial. One of the most common issues in which you could incur consists in the iCub simulator complaining about an incompatible version of YARP installed on your system. If this the case (and you have installed YARP on your computer via homebrew) you will have to download from the SVN the latest version of YARP and compile it by hand. The procedure for doing that is quite straightforward:
- Uninstall the homebrew version of YARP running:
brew uninstall yarp - Enter $ICUB_REPOSITORY and download the latest version of YARP via SVN, running the command:
svn co https://yarp0.svn.sourceforge.net/svnroot/yarp0/trunk/yarp2 - Add two new environment variables to your ~/.profile file:
export YARP_ROOT="$ICUB_REPOSITORY/yarp2"export YARP_DIR="$ICUB_REPOSITORY/yarp2/build"- Close and re-open the Terminal for the changes to the environment variables to be applied;
- Run:
mkdir $YARP_DIR - Enter $YARP_DIR (
cd $YARP_DIR) and run:ccmake .. - Configure the project (‘c‘ key) a few times, setting CMAKE_BUILD_TYPE to “Release, CREATE_GUIS to “ON“, CREATE_LIB_MATH to “ON“, CREATE_YMANAGER to “ON“, and (if available) CREATE_YMANAGER_GUI to “ON“. When it becomes available, press ‘g‘ to generate a Makefile and exit CMake
- Compile YARP running the
makecommand and install it with:sudo make install
For any question and/or feedback feel free to write me, or to post a message on the Robotcub Hackers mailing list.
Thanks, amongst the others, to Martin and Juxi for the work they have done on the subject in the past.
If anyone feels like preparing a PDF file out of the information contained in this tutorial, please give me a shout!

Comments(4)




