# Flashing: SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set

**URL:** <https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241>\
**Category:** Programming\
**Tags:** question\
**Created:** [October 8, 2019, 4:53pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241 "2019-10-08T16:53:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 8, 2019, 4:53pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/1 "2019-10-08T16:53:53Z")

</div>

Hi,

I want to see if I can upgrade my custom firmware to the latest version. So as a first step I just wanted to flash the latest firmware, before I try to merge in my changes.

I get this error:

```
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!

```

Here is some environment info - I tried to reclone everything as described in the README.md file

```
lasse@luke ~/D/A/Model01-Factory> pwd
/Users/lasse/Documents/Arduino/Model01-Factory
lasse@luke ~/D/A/Model01-Factory> ls -la ..
total 16
drwxr-xr-x 10 lasse staff 320 Oct 8 17:04 .
drwx------+ 154 lasse staff 4928 Oct 8 18:46 ..
-rw-r--r--@ 1 lasse staff 6148 Mar 27 2018 .DS_Store
drwxr-xr-x 8 lasse staff 256 Oct 8 16:53 Model01-Factory
drwxr-xr-x 15 lasse staff 480 May 9 21:59 Model01-Firmware
drwxr-xr-x 14 lasse staff 448 Nov 15 2018 Model01-Macware
drwxr-xr-x@ 4 lasse staff 128 Jan 24 2018 attiny_flasher
drwxr-xr-x 4 lasse staff 128 Mar 27 2018 attiny_flasher_org
drwxr-xr-x 3 lasse staff 96 Oct 8 17:04 hardware
drwxr-xr-x 3 lasse staff 96 Mar 11 2018 hw
lasse@luke ~/D/A/Model01-Factory> ls -la
total 144
drwxr-xr-x 8 lasse staff 256 Oct 8 16:53 .
drwxr-xr-x 10 lasse staff 320 Oct 8 17:04 ..
-rw-r--r-- 1 lasse staff 35141 Oct 8 16:52 LICENSE
-rw-r--r-- 1 lasse staff 2661 Oct 8 16:52 Makefile
-rw-r--r-- 1 lasse staff 21929 Oct 8 16:52 Model01-Firmware.ino
-rw-r--r-- 1 lasse staff 3908 Oct 8 16:52 README.md
-rw-r--r-- 1 lasse staff 275 Oct 8 16:52 library.properties
drwxr-xr-x 3 lasse staff 96 Oct 8 16:52 src
lasse@luke ~/D/A/Model01-Factory> make flash
BOARD_HARDWARE_PATH="/Users/lasse/Documents/Arduino/hardware" /Users/lasse/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder flash
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
ls: /.ino: No such file or directory
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
make: *** [flash] Error 1
lasse@luke ~/D/A/Model01-Factory>
```

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [October 9, 2019, 4:50pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/2 "2019-10-09T16:50:00Z")

</div>

Try copying the `.kaleidoscope-builder.conf` file from the official repo. The problem here is that you’re in a directory called `Model01-Factory`, and the build system expects the sketch name to be the same as the directory name. The default builder config explicitly sets the sketch name to `Model01-Firmware`, so no matter how you named the directory, it will build.

This is what you need in `.kaleidoscope-builder.conf`:

```auto
DEFAULT_SKETCH=Model01-Firmware

```

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 10, 2019, 10:12am UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/3 "2019-10-10T10:12:54Z")

</div>

Thank you. That helped, but I got one more error.

```
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: bad CPU type in executable

```

It turns out this is because macOS 10.15 (just out) no longer allows 32 bit binaries.  
So I have to wait for a new Arduino version for this to be fixed:

> <https://github.com/arduino/Arduino/issues/8626>
>
> MacOS Mojave 10.14.3, Arduino IDE 1.8.8.
> Can't compile ("verify") anything, as compile hangs at point "detecting libraries used". Happens with all my...

Just so you know … I will update when/if I find a solution.

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 10, 2019, 10:21am UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/4 "2019-10-10T10:21:10Z")

</div>

Just tested with Arduino 1.9.0-BETA and that version works with the macOS 10.15

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 10, 2019, 1:03pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/5 "2019-10-10T13:03:01Z")

</div>

Actually … one more issue. Maybe this is also macOS 10.15 catalina related?  
When actually flashing (hitting the prog key) I get this error:

```
avrdude: ser_open(): can't open device "/dev/cu.usbmodemkbio011": No such file or directory

```

What to do? Can you override the device path in `.kaleidoscope-builder.conf`?

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 10, 2019, 1:59pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/6 "2019-10-10T13:59:07Z")

</div>

My device is called:

```
lasse@luke ~/d/svu> ls -la /dev/cu.usb*
crw-rw-rw- 1 root wheel 18, 19 Oct 10 14:56 /dev/cu.usbmodemCDkbio011
```

---

<div class="post-metadata">

**Author:** ![jesse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jesse/32/361_2.png) [@jesse](https://community.keyboard.io/u/jesse)\
**Post date:** [October 10, 2019, 8:18pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/7 "2019-10-10T20:18:16Z")

</div>

Huh. We ought to be probing that from: [https://github.com/keyboardio/Kaleidoscope/blob/master/bin/find-device-port-macos](https://github.com/keyboardio/Kaleidoscope/blob/master/bin/find-device-port-macos)

If you try that tool standalone, does it work?

(This may indeed be Catalina breakage.)

---

<div class="post-metadata">

**Author:** ![merlin](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/merlin/32/3416_2.png) [@merlin](https://community.keyboard.io/u/merlin)\
**Post date:** [October 10, 2019, 9:49pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/8 "2019-10-10T21:49:00Z")

</div>

I just upgraded a machine to Catalina, but I haven’t had time to try to build or flash Kaleidoscope on it yet. It may be a few days before I get around to it, but if the device port scanner still isn’t fixed by then, I expect to be able to sort it out.

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 11, 2019, 9:07am UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/9 "2019-10-11T09:07:09Z")

</div>

Hmm the tool seems to work standalone, but it tries a different /dev when flashing

Full log:

```
lasse@luke ~/D/A/Model01-Factory> chmod +x ../hardware/keyboardio/avr/libraries/Kaleidoscope/bin/find-device-port-macos
lasse@luke ~/D/A/Model01-Factory> ../hardware/keyboardio/avr/libraries/Kaleidoscope/bin/find-device-port-macos
2019-10-11 11:04:44.208 system_profiler[53030:839727] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:04:44.209 system_profiler[53030:839727] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
/dev/cu.usbmodemCDkbio011

```

but make flash picks /dev/cu.usbmodemkbio011

```
lasse@luke ~/D/A/Model01-Factory> make flash
BOARD_HARDWARE_PATH="/Users/lasse/Documents/Arduino/hardware" /Users/lasse/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder flash
Building ./Model01-Firmware 0.0.0 into /var/folders/bh/blvc1l9n4dv2m9h0pg_hzdf80000gn/T//kaleidoscope-lasse/sketch/8852701481-Model01-Firmware.ino/output...
- Size: firmware/Model01-Firmware/Model01-Firmware-0.0.0.elf
  - Program: 25010 bytes (87.2% Full)
  - Data: 1338 bytes (52.3% Full)

To update your keyboard's firmware, hold down the 'Prog' key on your keyboard,
and then press 'Enter'.

When the 'Prog' key glows red, you can release it.

^[^[^[^[^[^[^[^[^[^[^[^[^[
2019-10-11 11:05:15.278 system_profiler[53336:840482] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:15.279 system_profiler[53336:840482] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:18.533 system_profiler[53347:840575] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:18.534 system_profiler[53347:840575] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
Connecting to programmer: .avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding

avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_drain(): read error: Device not configured
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = ""; type =
    Software Version = .; Hardware Version = .
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader
avrdude: ser_close(): can't reset attributes for device: Device not configured
avrdude: ser_open(): can't open device "/dev/cu.usbmodemkbio011": No such file or directory
make: *** [flash] Error 1
lasse@luke ~/D/A/Model01-Factory>
```

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [October 16, 2019, 10:20am UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/10 "2019-10-16T10:20:03Z")

</div>

I am stuck. Don’t know what to try next.  
Any suggestions?  
Is there anything I can do to try help debug this?

---

<div class="post-metadata">

**Author:** ![jesse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jesse/32/361_2.png) [@jesse](https://community.keyboard.io/u/jesse)\
**Post date:** [October 22, 2019, 5:50pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/11 "2019-10-22T17:50:29Z")

</div>

We’ve found the root cause. Catalina broke flashing of the Model 01, along with every Arduino based on the ATMega32U4. It sounds like Apple will be pushing a fix in a point release in the near future.

---

<div class="post-metadata">

**Author:** ![lasse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lasse/32/185_2.png) [@lasse](https://community.keyboard.io/u/lasse)\
**Post date:** [November 8, 2019, 6:13pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/12 "2019-11-08T18:13:16Z")

</div>

Now I am on macOS 10.15.1 (19B88)  
I can report that I still get the same error …

---

<div class="post-metadata">

**Author:** ![jesse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jesse/32/361_2.png) [@jesse](https://community.keyboard.io/u/jesse)\
**Post date:** [November 8, 2019, 6:28pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/13 "2019-11-08T18:28:36Z")

</div>

As I understand it, 10.15.1 was already locked down before this bug got discovered inside apple.

---

<div class="post-metadata">

**Author:** ![cro](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/cro/32/2809_2.png) [@cro](https://community.keyboard.io/u/cro)\
**Post date:** [January 9, 2020, 10:22pm UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/14 "2020-01-09T22:22:09Z")

</div>

Anyone know if this is corrected in 10.15.2?

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [January 10, 2020, 9:18am UTC](https://community.keyboard.io/t/flashing-sketch-library-sourcedir-and-root-need-to-be-set/3241/15 "2020-01-10T09:18:50Z")

</div>

It is, you should be able to flash the Model01 on 10.15.2.
