Details
Hey there! Thank you for your work on this repo. I ran into an issue when trying to compile for an ATTiny 1616. After some sleuthing, here's my best guess as to what's going on:
On macOS, the recipe.hooks.objcopy.postobjcopy patterns in platform.txt wrap commands in bash -c "..." but leave the .elf and output file paths unquoted inside the string. When the build path contains spaces (e.g. a project inside ~/Foo Bar/), the shell splits the path on whitespace and avr-objdump/avr-nm fail with No such file or directory.
From what I can tell, the Windows pattern already quotes paths correctly using "...". The macOS and Linux patterns do not.
Steps to reproduce:
NOTE: this does not impact compilation from Arduino studio. This only seems to come into effect when called from the CLI like arduino-cli compile --profile ATtiny1616 -v --jobs 0 --build-path <path>. I'm actually not doing this directly, but an IDE extension I'm using does call the CLI in this manner for whatever reason.
- Install
megaTinyCore:megaavr 2.6.12
- Use megaTinyCore with any sketch whose build path contains spaces
- Compile via the CLI. the core files build successfully but the post-build step fails with exit status 1
- Verbose output shows:
avr-objdump-related no such file errors
- See the script reports
Error during build: exit status 1
Potential fix
I've applied this fix locally and it seems to work but this is far from my area of expertise:
(platform.txt, lines 129–130, 134–135):
-recipe.hooks.objcopy.postobjcopy.1.pattern.linux=bash -c "{compiler.path}{compiler.objdump.cmd} {compiler.objdump.flags} {build.path}/{build.project_name}.elf > {build.path}/{build.project_name}.lst"
-recipe.hooks.objcopy.postobjcopy.1.pattern.macosx=bash -c "{compiler.path}{compiler.objdump.cmd} {compiler.objdump.flags} {build.path}/{build.project_name}.elf > {build.path}/{build.project_name}.lst"
+recipe.hooks.objcopy.postobjcopy.1.pattern.linux=bash -c '{compiler.path}{compiler.objdump.cmd} {compiler.objdump.flags} "{build.path}/{build.project_name}.elf" > "{build.path}/{build.project_name}.lst"'
+recipe.hooks.objcopy.postobjcopy.1.pattern.macosx=bash -c '{compiler.path}{compiler.objdump.cmd} {compiler.objdump.flags} "{build.path}/{build.project_name}.elf" > "{build.path}/{build.project_name}.lst"'
-recipe.hooks.objcopy.postobjcopy.2.pattern.linux=bash -c "{compiler.path}{compiler.nm.cmd} {compiler.nm.flags} {build.path}/{build.project_name}.elf > {build.path}/{build.project_name}.map"
-recipe.hooks.objcopy.postobjcopy.2.pattern.macosx=bash -c "{compiler.path}{compiler.nm.cmd} {compiler.nm.flags} {build.path}/{build.project_name}.elf > {build.path}/{build.project_name}.map"
+recipe.hooks.objcopy.postobjcopy.2.pattern.linux=bash -c '{compiler.path}{compiler.nm.cmd} {compiler.nm.flags} "{build.path}/{build.project_name}.elf" > "{build.path}/{build.project_name}.map"'
+recipe.hooks.objcopy.postobjcopy.2.pattern.macosx=bash -c '{compiler.path}{compiler.nm.cmd} {compiler.nm.flags} "{build.path}/{build.project_name}.elf" > "{build.path}/{build.project_name}.map"'
The fix switches the outer bash -c delimiter to single quotes (so the inner double quotes are passed literally to the shell rather than being interpreted by arduino-cli's template expansion), and applies the same fix to Linux since it has the identical bug.
If that passes the sniff test, please let me know and I'll open a PR!
Thanks again
Details
Hey there! Thank you for your work on this repo. I ran into an issue when trying to compile for an ATTiny 1616. After some sleuthing, here's my best guess as to what's going on:
On macOS, the
recipe.hooks.objcopy.postobjcopypatterns inplatform.txtwrap commands inbash -c "..."but leave the.elfand output file paths unquoted inside the string. When the build path contains spaces (e.g. a project inside~/Foo Bar/), the shell splits the path on whitespace andavr-objdump/avr-nmfail withNo such file or directory.From what I can tell, the Windows pattern already quotes paths correctly using
"...". The macOS and Linux patterns do not.Steps to reproduce:
NOTE: this does not impact compilation from Arduino studio. This only seems to come into effect when called from the CLI like
arduino-cli compile --profile ATtiny1616 -v --jobs 0 --build-path <path>. I'm actually not doing this directly, but an IDE extension I'm using does call the CLI in this manner for whatever reason.megaTinyCore:megaavr 2.6.12avr-objdump-related no such file errorsError during build: exit status 1Potential fix
I've applied this fix locally and it seems to work but this is far from my area of expertise:
(platform.txt, lines 129–130, 134–135):The fix switches the outer bash -c delimiter to single quotes (so the inner double quotes are passed literally to the shell rather than being interpreted by arduino-cli's template expansion), and applies the same fix to Linux since it has the identical bug.
If that passes the sniff test, please let me know and I'll open a PR!
Thanks again