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:


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?

| improve this question | | | | |

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 \
| improve this answer | | | | |
  • Is there a way to upload the compiled program to the Arduino using arduino-builder or some other cli tool? – AstroFloyd Mar 4 '18 at 9:30
  • This seems to do the trick for me: avrdude -V -F -C /etc/avrdude.conf -p atmega328p -P /dev/ttyACM0 -c arduino -b 115200 -U flash:w:sketch.hex – AstroFloyd Mar 5 '18 at 7:57

Take the .h and the .cpp files and zip them together. Go to your Arduino sketch and click Sketch>Include Library> Add .ZIP library and import your library.

Again go to Sketch>Include library and select your library on the list. Some #iport lines will appear in the C++ code editor. Your library will be imported into the sketch.

For more information, take a look at: https://www.arduino.cc/en/Guide/Libraries

| improve this answer | | | | |
  • 3
    This answer has nothing to do with arduino-builder. Also, #iport? This is Arduino, not an iPad. It's #include. – per1234 Mar 4 '17 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.