Getting started with mruby (Part 1)

by Yuji Yokoo


I have recently been playing around with mruby. I would like to share some of my notes here.

Overview

There are lots of mruby information available, so I won't go into fine details but simply, it is a "new ruby" from Yukihiro Matsumoto, aka Matz. It is a small, compact, modular ruby intended for embedded environments, like home appliances and portable electronics. It runs on RiteVM and is not intended to be fully compatible with YARV or MRI. It currently does not have features like file IO (no "require"), regular expression, and "eval". mruby code can be compiled into C code.

Environment

To make things easy, I am using a vagrant box. It was a while ago, but I think I downloaded the "Debian Squeeze amd64 (with Puppet, Chef and VirtualBox 4.2.1)" from http://www.vagrantbox.es/ :

Now you should be able to use the vagrant environment. If you want to follow the steps here and upload code to an openwrt router later, you have to change the networking to the bridged mode in Vagrantfile but it's optional, and you might not have an openwrt-compatible router to play with.

Building mruby

Building mruby is extremely easy (well, it was, for me):

This failed because it's missing bison. Let's install bison and retry:

should do it. You can try the following to check that it's worked:

It's working!