help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

microscheme fails to assemble BLINK.ms due to avr-gcc search path issue


From: Milind Kamble
Subject: microscheme fails to assemble BLINK.ms due to avr-gcc search path issue
Date: Sat, 24 Sep 2022 18:53:57 -0500

Hello,
   I have installed avr-toolchain 10.3.0 and microscheme 0.9.3
When I try to assemble a simple BLINK.ms (copied from the
examples/BLINK.ms from the microscheme github repo), I get the
following errors:

~/tmp> microscheme -v -m UNO -d /dev/ttyACM0 -a ./BLINK.ms
Microscheme 0.9.3, (C) Ryan Suchocki
>> './BLINK.ms' found.
>> Treeshaker: After 4 rounds: 89 globals purged! 22 bytes will be reserved.
>> Remaining globals: [forever arduino-ports arduino-pins set-ddr set-pin high? 
>> output low? toggle led-pin loop ]
>> 21 lines compiled OK
>> Assembling...
avr-ld: cannot find crtatmega328p.o: No such file or directory
avr-ld: cannot find -lm
avr-ld: cannot find -lc
avr-ld: cannot find -latmega328p
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)
>> Finished.

To debug the issue, I cloned the microscheme from github and built the
tool . Running that version also gave the exact same error. So after
combing for hints online, I realized that perhaps the "-B" flag needs
to be provided in the avr-gcc command launched by microscheme. And
that worked.
So the hack needed to make it work was
avr-gcc -mmcu=atmega328p -B ~/.guix-profile/avr/lib/avr5 -o BLINK.elf BLINK.s


 ~/.guix-profile/avr/lib/avr5 is a link to
/gnu/store/r7kn43jwf4qj9lagj0pr4irzrwbvls0b-avr-libc-2.0.0/avr/lib/avr5
  -- the key point being it points to a subdirectory of avr-libc
But the default search path of avr-gcc does not include avr-libc in
the store. Hence the -B hack works.

The question is why do we need to specify -B explicitly. avr-libs
should be included in the search path for avr-gcc.
What am I missing?

-Milind



reply via email to

[Prev in Thread] Current Thread [Next in Thread]