Skip to content

MORSE on OSX using Homebrew

Nick Hawes edited this page May 23, 2013 · 12 revisions

Installing

Tonight I installed and ran MORSE (up to the first tutorial at least) under OSX. This was done using Homebrew. The steps I took were as follows

  1. Download Blender from the Blender download page, and copy the apps to /Applications. I used Blender 2.67a 64 bit.

  2. As that Blender uses Python 3.3.0 you need to install the exact matching version for your system. I did this using Homebrew. You have to go through some extra steps as the current version of Python is 3.3.1. The hash for the checkout command comes from brew versions python3.

$ cd /usr/local
$ git checkout 864e9f1 /usr/local/Library/Formula/python3.rb
$ brew install python3

Then make sure pkg-config can find this install

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/Current/lib/pkgconfig
  1. I installed MORSE using the manual installation instructions. However, I needed a bit of a hack to get this working. First, the compiled Python modules wouldn't link against the Python libs, so I edit line 261 of config/FindPythonLibs.cmake to be the following
TARGET_LINK_LIBRARIES(${_NAME} python3.3m)

There's probably a more elegant way of fixing this, but I didn't look for it. I then ran ccmake as follows

$ mkdir build && cd build
$ ccmake -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/Current/include/python3.3m -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework -DBUILD_ROS_SUPPORT=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt -DPYTHON_EXECUTABLE=/usr/local/bin/python3.3  -DCMAKE_MODULE_LINKER_FLAGS=`pkg-config --libs python3` ..
$ sudo make install
  1. To allow MORSE to find Blender I set MORSE_BLENDER as follows:
$ export MORSE_BLENDER=/Applications/blender.app/Contents/MacOS/blender
  1. At this point morse check should succeed (despite some minor Blender complaints), and you can run the basic tutorial:
$ morse run /opt/share/morse/examples/tutorials/tutorial-1-sockets.py 

and in another terminal

$ telnet localhost 4000

followed by

id1 atrv.motion set_speed [2, -1]

This should make your robot go in a circle in the simulation.

Problems

If you see an error like the following

''' Traceback (most recent call last): File "/opt/bin/morse", line 825, in args.func(args) File "/opt/bin/morse", line 645, in do_check check_setup() File "/opt/bin/morse", line 275, in check_setup blender_prefix = os.path.join(os.path.normpath(prefix), os.path.normpath("bin/blender")) NameError: global name 'prefix' is not defined '''

it means that MORSE can't find Blender. Set MORSE_BLENDER as above.

Clone this wiki locally