Skip to content

Compilation Error: #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SConaway opened this issue Nov 3, 2018 · 3 comments · Fixed by #136
Closed

Compilation Error: #84

SConaway opened this issue Nov 3, 2018 · 3 comments · Fixed by #136

Comments

@SConaway
Copy link
Contributor

SConaway commented Nov 3, 2018

The latest cli (0.3.2) fails to compile anything, giving the error:

$ arduino-cli compile -b arduino:avr:uno rfid_unlock/rfid_unlock.ino
Downloading and installing missing tool: builtin:[email protected]
Downloading builtin:[email protected]...

 0 / 111604    0.00%
builtin:[email protected] downloaded
Installing builtin:[email protected]
builtin:[email protected] installed
Alternatives for SPI.h: [[email protected]]
ResolveLibrary(SPI.h)
  -> candidates: [[email protected]]
Alternatives for MFRC522.h: [[email protected]]
ResolveLibrary(MFRC522.h)
  -> candidates: [[email protected]]
Sketch uses 4426 bytes (13%) of program storage space. Maximum is 32256 bytes.
Global variables use 211 bytes (10%) of dynamic memory, leaving 1837 bytes for local variables. Maximum is 2048 bytes.
Error: open rfid_unlock/rfid_unlock.ino/rfid_unlock.ino.arduino.avr.uno.hex: not a directory
Error copying output file.
ERROR: Job failed: exit code 1
@flatsiedatsie
Copy link

flatsiedatsie commented Dec 20, 2018

Do you also have the Arduino IDE installed on the system?

I'm getting the same thing with 0.3.3 on a mac with the IDE installed. This is trying to install the blink sketch from a non-default location:

Using board 'nano' from platform in folder: /Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23
Using core 'arduino' from platform in folder: /Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23
Detecting libraries used...
/Users/USERNAME/Library/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23/variants/eightanaloginputs /tmp/arduino-sketch-95F0F69F9B0DF239A981D9CEDC79E77A/sketch/blink3.ino.cpp -o /dev/null
Generating function prototypes...
/Users/USERNAME/Library/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/Users/USERNAME/Library/arduino15/packages/arduino/hardware/avr/1.6.23/variants/eightanaloginputs /tmp/arduino-sketch-95F0F69F9B0DF239A981D9CEDC79E77A/sketch/blink3.ino.cpp -o /tmp/arduino-sketch-95F0F69F9B0DF239A981D9CEDC79E77A/preproc/ctags_target_for_gcc_minus_e.cpp
/Users/USERNAME/Library/arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino-sketch-95F0F69F9B0DF239A981D9CEDC79E77A/preproc/ctags_target_for_gcc_minus_e.cpp
Error: exit status 1
Compilation failed.

@SConaway
Copy link
Contributor Author

SConaway commented Dec 20, 2018

You're calling the command wrong. This is what works for me. (My makefile):

BOARD := "arduino:avr:uno"
PORT := "/dev/tty.wchusbserial1430"

.PHONY: compile

compile: rfid_unlock.ino
	arduino-cli compile --fqbn $(BOARD) .

.PHONY: upload

upload:
	test -e $(PORT) || { echo "Port not found!"; exit 1; }
	$(MAKE) compile

	arduino-cli upload  --fqbn $(BOARD) -p $(PORT) .

.PHONY: clean

clean:
	rm -rf build/*
	rm -f *.hex *.elf

Just give it the directory and it'll find the sketch.

@flatsiedatsie
Copy link

flatsiedatsie commented Dec 20, 2018

Thanks! I'll try again.

I'm calling it from PHP like this:

shell_exec('./arduino-cli compile --fqbn arduino:avr:nano ' . $path . ' -v > "./uploadoutput.txt"; ./arduino-cli upload -p ' . $port . ' --fqbn arduino:avr:nano:cpu=atmega328old ' . $path . ' -t -v');

The arduino-cli file is in a random folder. Beneath it is a folder called "code" that holds the Arduino folder and file.

update: the same code works when placed on a headless Raspberry Pi which does not have the IDE.

@SConaway SConaway closed this as completed Jan 2, 2019
per1234 pushed a commit that referenced this issue Nov 16, 2020
add cloud blink example for mkr nb 1500
per1234 added a commit that referenced this issue Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants