01 Jan 2018

How to compile mBlock on Ubuntu

mBlock

mBlock is an IDE to program Arduino via the scratch language. The same project is used to program mBot robot. Unfortunately, mBlock is not released in its latest version for Linux so I had to recompile it from scratch. This post is about the procedure I had to do in order to get everything right.

Install nodejs

First thing is to install nodeJS. There is already a trick to know

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Reference is from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Install npm

From Ubuntu packages

sudo apt install npm

Install necessary development libraries

sudo apt install libbluetooth-dev
sudo apt install libusb-1.0-0-dev

Follow installation from mBlock github

Reference: https://github.com/Makeblock-official/mBlock

First clone mBlock

git clone https://github.com/Makeblock-official/mBlock.git

Then compile everything with npm

npm install
npm run rebuild-serialport
npm run rebuild-hid
npm run rebuild-bluetooth

Install extra dependencies

npm install --save-dev electron-prebuilt

Start mBlock

npm start
Thank You For Reading
Laurent Carlier

Do not hesitate to leave a comment. If see an error, you can issue a pullme request om my github