createcandle / Candle-manager-addon

An add-on for the Candle Controller / WebThings Gateway. It allows you to upload code to Arduino's with the click of a button.
MIT License
5 stars 5 forks source link

Compiling failed during candle_reciever creation #34

Closed TheToddLuci0 closed 2 years ago

TheToddLuci0 commented 3 years ago

When attempting initial setup, compilation fails when attempting to configure the Candle_receiver . WebThings logs show the following

2021-03-09 23:22:24.829 INFO   : Candle-manager-addon: New device plugged into port /dev/ttyUSB0
2021-03-09 23:22:24.832 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:24] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:24.849 INFO   : Candle-manager-addon: Scanning source file directory
2021-03-09 23:22:24.851 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:24] "GET /source HTTP/1.1" 200 -
2021-03-09 23:22:25.832 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:25] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:26.847 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:26] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:27.586 INFO   : Candle-manager-addon: generate_new_code: False
2021-03-09 23:22:27.588 INFO   : Candle-manager-addon: Extracting settings from .ino file
2021-03-09 23:22:27.590 INFO   : Candle-manager-addon: change_settings source path: /home/pi/.webthings/data/Candle-manager-addon/source/Candle_receiver/Candle_receiver.ino
2021-03-09 23:22:27.594 INFO   : Candle-manager-addon: Done with settings
2021-03-09 23:22:27.595 INFO   : Candle-manager-addon: Breaking early, since there is no need to scan all the Arduino code yet.
2021-03-09 23:22:27.599 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:27] "GET /extract/4 HTTP/1.1" 200 -
2021-03-09 23:22:27.876 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:27] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:28.832 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:28] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:29.834 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:29] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:30.060 INFO   : Candle-manager-addon: generate_new_code: True
2021-03-09 23:22:30.062 INFO   : Candle-manager-addon: Creating new code from new desired settings:[1, 1]
2021-03-09 23:22:30.063 INFO   : Candle-manager-addon: change_settings source path: /home/pi/.webthings/data/Candle-manager-addon/source/Candle_receiver/Candle_receiver.ino
2021-03-09 23:22:30.067 INFO   : Candle-manager-addon: Done with settings
2021-03-09 23:22:30.069 INFO   : Candle-manager-addon: found security line
2021-03-09 23:22:30.070 INFO   : Candle-manager-addon: updated security line:#define MY_ENCRYPTION_SIMPLE_PASSWD "changeme"      // The Candle Manager add-on will change this into the actual password your network uses.
2021-03-09 23:22:30.075 INFO   : Candle-manager-addon: 
2021-03-09 23:22:30.077 INFO   : Candle-manager-addon: library name:MySensors
2021-03-09 23:22:30.085 INFO   : Candle-manager-addon: -Library is already installed, skipping.
2021-03-09 23:22:30.086 INFO   : Candle-manager-addon: done scanning libraries
2021-03-09 23:22:30.087 INFO   : Candle-manager-addon: The code has this number of settings: 2
2021-03-09 23:22:30.088 INFO   : Candle-manager-addon: Saved the new code
2021-03-09 23:22:30.090 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:30] "POST /generate_code/4 HTTP/1.1" 200 -
2021-03-09 23:22:30.207 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:30] "GET /check_libraries/4 HTTP/1.1" 200 -
2021-03-09 23:22:30.236 INFO   : Candle-manager-addon: Compiling: Candle_receiver
2021-03-09 23:22:30.252 INFO   : Candle-manager-addon: command = /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli compile -v --fqbn arduino:avr:nano /home/pi/.webthings/data/Candle-manager-addon/code/Candle_receiver
2021-03-09 23:22:30.835 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:30] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:31.835 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:31] "GET /scanUSB HTTP/1.1" 200 -
2021-03-09 23:22:32.506 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:32] "GET /compile/4 HTTP/1.1" 200 -
2021-03-09 23:22:32.833 ERROR  : Candle-manager-addon: 192.168.4.58 - - [09/Mar/2021 23:22:32] "GET /scanUSB HTTP/1.1" 200 -

Running the commands directly in the shell yields the following

pi@gateway:~ $ /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli compile -v --fqbn arduino:avr:nano /home/pi/.webthings/data/Candle-manager-addon/code/Candle_receiver

Error during build: platform not installed

Pi 3B Arduino RF-Nano Gateway installed direct from Mozilla today.

createcandle commented 3 years ago

Interesting. Thanks for the detailed logs.

Do you see Error: CLI update index failed or CLI update AVR failed earlier in the logs perhaps? Perhaps the command timed out. How is your internet speed?

This command will fix the problem: /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli core install arduino:avr

In theory a reboot might also fix the issue.

TheToddLuci0 commented 3 years ago

That command did resolve the issue, thanks.

More debug info if you're interested. I've got gigabit internet, so that shouldn't be a limiting factor.

I did find the following:

pi@gateway:~/.webthings/log $ grep -R "CLI update index failed" -C 10
run-app.log.2021-03-09-2021-03-09 22:29:24.973 INFO   : Candle-manager-addon:  * Serving Flask app "pkg.candle_adapter" (lazy loading)
run-app.log.2021-03-09-2021-03-09 22:29:24.975 INFO   : Candle-manager-addon:  * Environment: production
run-app.log.2021-03-09-2021-03-09 22:29:24.976 INFO   : Candle-manager-addon:    WARNING: This is a development server. Do not use it in a production deployment.
run-app.log.2021-03-09-2021-03-09 22:29:24.978 INFO   : Candle-manager-addon:    Use a production WSGI server instead.
run-app.log.2021-03-09-2021-03-09 22:29:24.979 INFO   : Candle-manager-addon:  * Debug mode: off
run-app.log.2021-03-09-2021-03-09 22:29:24.981 ERROR  : Candle-manager-addon:  * Running on http://0.0.0.0:8686/ (Press CTRL+C to quit)
run-app.log.2021-03-09-2021-03-09 22:29:29.817 INFO   : Candle-manager-addon: Scanning source file directory
run-app.log.2021-03-09-2021-03-09 22:29:29.841 INFO   : Candle-manager-addon: Run command error: /bin/sh: 1: /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli: Permission denied
run-app.log.2021-03-09-2021-03-09 22:29:29.843 INFO   : Candle-manager-addon:
run-app.log.2021-03-09-2021-03-09 22:29:29.845 INFO   : Candle-manager-addon: Command failed
run-app.log.2021-03-09:2021-03-09 22:29:29.846 INFO   : Candle-manager-addon: Error: CLI update index failed
run-app.log.2021-03-09-2021-03-09 22:29:29.848 INFO   : Candle-manager-addon: - PROBLEMATIC ARDUINO UPDATE COMMAND WAS: /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli core update-index
run-app.log.2021-03-09-2021-03-09 22:29:29.850 INFO   : Candle-manager-addon: Warning: could not check for updates for the Arduino CLI (no internet connection?)
run-app.log.2021-03-09-2021-03-09 22:29:29.852 INFO   : Candle-manager-addon: Looking for already installed libraries
run-app.log.2021-03-09-2021-03-09 22:29:29.854 INFO   : Candle-manager-addon: check_installed_arduino_libraries command = /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli lib list --all --format=json
run-app.log.2021-03-09-2021-03-09 22:29:29.856 INFO   : Candle-manager-addon: Failed to check libraries: Expecting value: line 1 column 1 (char 0)
run-app.log.2021-03-09-2021-03-09 22:29:29.858 INFO   : Candle-manager-addon: Downloading Arduino library: Grove - Barometer Sensor BME280
run-app.log.2021-03-09-2021-03-09 22:29:29.860 INFO   : Candle-manager-addon: library install command: /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli lib install "Grove - Barometer Sensor BME280"
run-app.log.2021-03-09-2021-03-09 22:29:29.869 INFO   : Candle-manager-addon: Downloading Arduino library: SSD1306Ascii
run-app.log.2021-03-09-2021-03-09 22:29:29.872 INFO   : Candle-manager-addon: library install command: /home/pi/.webthings/addons/Candle-manager-addon/arduino-cli/linux-armv7/arduino-cli lib install "SSD1306Ascii"
run-app.log.2021-03-09-2021-03-09 22:29:29.882 INFO   : Candle-manager-addon: Downloading Arduino library: DallasTemperature
createcandle commented 3 years ago

Thanks. I've created a fix. Will be available within a day.