Hi Guix, I’ve been wanting to use microscheme to do fun things with my AVR microcontrollers. Sadly, I haven’t been able to make the combination of microscheme, avrdude, and avr-gcc work.
Here’s what I did first: guix package -i microscheme avrdude gcc-cross-sans-libc-avr avr-libc The microscheme package includes some examples, so I tried to compile and upload the BLINK example: ~~~~~~~~~~~~~~~ rekado@banana ~ $ microscheme -a -u -m UNO -d /dev/bus/usb/006/004 microscheme-0.9.2/examples/BLINK.ms Microscheme 0.9.2, (C) Ryan Suchocki >> Treeshaker: After 4 rounds: 87 globals purged! 22 bytes will be reserved. >> 18 lines compiled OK >> Assembling... avr-ld: cannot open linker script file ldscripts/avr5.xn: No such file or directory collect2: error: ld returned 1 exit status >> Warning: Command may have failed. (Exit code 256) sh: avr-objcopy: command not found >> Warning: Command may have failed. (Exit code 32512) ... ~~~~~~~~~~~~~~~ So, a problem with a linker script that cannot be found and a missing avr-objcopy. I found them in the binutils-cross-avr output in the store, but since there’s no separate package for this I installed it like this: guix package -i /gnu/store/5f7pp8r9wpwzsf61cf406xb1hkad2cdi-binutils-cross-avr-2.25.1 Now running microscheme again produces this: ~~~~~~~~~~~~~~~ Microscheme 0.9.2, (C) Ryan Suchocki >> Treeshaker: After 4 rounds: 87 globals purged! 22 bytes will be reserved. >> 18 lines compiled OK >> Assembling... avr-ld: cannot find crtm328p.o: No such file or directory avr-ld: cannot find -lm avr-ld: cannot find -lc collect2: error: ld returned 1 exit status >> Warning: Command may have failed. (Exit code 256) avr-objcopy: 'BLINK.elf': No such file >> Warning: Command may have failed. (Exit code 256) >> Uploading... avrdude: ser_open(): can't set attributes for device "/dev/bus/usb/006/004": Inappropriate ioctl for device avrdude done. Thank you. >> Warning: Command may have failed. (Exit code 256) >> Finished. ~~~~~~~~~~~~~~~ There are multiple copies of “libm.a” and “libc.a” and there’s a “crtm328p.o” as well somewhere below the “avr/lib/” directory in the output of the avr-libc package. Even after adding these paths to LIBRARY_PATH, however, I cannot seem to fix the linker errors above. Then I realised that LIBRARY_PATH only works for native compilers, and that I would need to pass flags to the compiler (“-L”, maybe?). But this all seems very wrong. How can we fix this elegantly? Does microscheme’s call to avr-gcc need to be patched to “-L” the avr-libc path? Or does avr-gcc need fixing? Or something else entirely? ~~ Ricardo