After building VirtualBox with VNC support in my previous post I discovered two problems with that installation (VirtualBox 4.1.2 on Mac OS X Lion 10.7):
- SDK was not installed by default, import vboxapi from python failed.
- VBox Python bindings were built for python 2.6 and segfaults on python 2.7
I contacted some guys on
#vbox-dev on IRC and it what happened is that VirtualBox 4.1.2 was not built for Lion and all build scripts are configured for 10.6. So, I decided to hack my way around for the second time to fix the two issues.
To cut the very long story short, you need to create your own port local repository like how I described in that post and remove the virtualbox directory inside emulators/ and replace it with the patched port (Edit: You don't need this file anymore since the patch is already applied to macports now)
Steps to do download and extract are:
cd ~/ports/emulators curl -O "http://ahmedsoliman.com/myspace/patches/virtualbox-vnc-lion.tar.gz" tar vxzf virtualbox-vnc-lion.tar.gz
The you should just try to install virtualbox again:
sudo port install virtualbox +vnc +vde2
After installation you should be able immediately to use the Python APIs, open iPython and try the following:
import vboxapi mgr = vboxapi.VirtualBoxManager(None, None)
If this code succeeded without throwing any exceptions then you should be really happy :)
I've also created a relevant ticket on MacPorts for that 31328
Update: The ticket was fixed and you do not need to apply any patches anymore. This post is here for historical reasons only!