Alex079 / vscode-avr-helper

Helper extension to simplify code compilation and flashing for AVR chips
MIT License
12 stars 1 forks source link

Build Failure when working with codespace. #9

Closed IAM-Carbon-Based closed 3 years ago

IAM-Carbon-Based commented 3 years ago

I have run into the issue of builds failing after i have created a workspace file in the root of my project

 >Executing task in folder gripper_attiny85: make -f/Users/iamcb/dev/gripper_attiny85/.vscode/avr.targets.mk build <
avr-g++: warning: gripper_attiny85.code-workspace: linker input file unused because linking not done
avr-g++: warning: gripper_attiny85.code-workspace: linker input file unused because linking not done
===== Making .vscode/avr.build/obj/gripper_attiny85.o
avr-g++: warning: gripper_attiny85.code-workspace: linker input file unused because linking not done
===== Making .vscode/avr.build/obj/src/main.o
===== Making .vscode/avr.build/output.elf
avr-g++: error: .vscode/avr.build/obj/gripper_attiny85.o: No such file or directory
make: *** [.vscode/avr.build/output.elf] Error 1
The terminal process "/opt/local/bin/zsh '-c', 'make -f/Users/iamcb/dev/gripper_attiny85/.vscode/avr.targets.mk build'" terminated with exit code: 2.
Terminal will be reused by tasks, press any key to close it.

I have actually got the build to succeed by adding this line to the avr.targets.mk file

A.src := $(call F.dep,$(sort $(wildcard *.c*) $(wildcard */*.c*) $(wildcard */*/*.c*) $(wildcard *.C) $(wildcard */*.C) $(wildcard */*/*.C)))
A.src := $(filter-out $(wildcard *.code-workspace), $(A.src)) <----- Added This
A.obj := $(addprefix $(A.output.dir)/obj/,$(addsuffix .o,$(basename $(A.src))))

It would seem that the wildcard selection also includes the .code-workspace file created by VSCode as a source file.

after adding this line to filter it out the build process cess completes however i still receive this error:

> Executing task in folder gripper_attiny85: make -f/Users/iamcb/dev/gripper_attiny85/.vscode/avr.targets.mk build <

avr-gcc: warning: gripper_attiny85.code-workspace: linker input file unused because linking not done
avr-gcc: warning: gripper_attiny85.code-workspace: linker input file unused because linking not done
===== Making .vscode/avr.build/output.elf

===== Making .vscode/avr.build/output.lst

I'm unsure as to why this linker error pops up and I'm not completely sure this is the right fix, but at least i have it working now. Any insight into this would be helpful. aside from this hiccup, the extension works great.

Alex079 commented 3 years ago

Hello! Thank you for reporting the issue. The cause is that the .code-workspace file was mistaken for a source file and was expected to produce a .o file. The change you made filters only the list of src but not the list obj. I will try to fix it by explicitly listing the source file extensions instead of using .c*.