How to compile a sketch using arduino-builder? How do you compile a sketch with a custom library path using arduino-builder? The docs are a little light.

I have my source code organized like this:

lib
    SomeLib
        somelib.h
        somelib.cpp
src
    otherfile.h
    main.ino


I've installed Arduino 1.8.1 into /usr/share/arduino.

I'm trying to compile this for an Arduino Uno from my project root directory with:

arduino-builder -compile -hardware /usr/share/arduino/hardware -tools /usr/share/arduino/hardware/tools -libraries lib -fqbn arduino:avr:uno -build-path .build src/main.ino


But it returns this error:

fork/exec {runtime.tools.ctags.path}/ctags: no such file or directory


What's causing this error?
You need to specify the path to the tools-builder folder, which is where ctags is. Try this:

arduino-builder \
  -compile \
  -hardware /usr/share/arduino/hardware \
  -tools /usr/share/arduino/hardware/tools \
  -tools /usr/share/arduino/tools-builder \
  -libraries lib \
  -fqbn arduino:avr:uno \
  -build-path .build \
  src/main.ino