From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: avr-gcc Date: Tue, 17 Nov 2015 16:25:54 +0100 Message-ID: <87wptgmyv1.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyi90-0001KN-DJ for guix-devel@gnu.org; Tue, 17 Nov 2015 10:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyi8v-00016X-Ew for guix-devel@gnu.org; Tue, 17 Nov 2015 10:26:06 -0500 Received: from sender163-mail.zoho.com ([74.201.84.163]:24740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyi8v-00016N-5W for guix-devel@gnu.org; Tue, 17 Nov 2015 10:26:01 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: "guix-devel@gnu.org" 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