unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* microscheme fails to assemble BLINK.ms due to avr-gcc search path issue
@ 2022-09-24 23:53 Milind Kamble
  2022-10-28 14:29 ` zimoun
  0 siblings, 1 reply; 2+ messages in thread
From: Milind Kamble @ 2022-09-24 23:53 UTC (permalink / raw)
  To: help-guix

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: microscheme fails to assemble BLINK.ms due to avr-gcc search path issue
  2022-09-24 23:53 microscheme fails to assemble BLINK.ms due to avr-gcc search path issue Milind Kamble
@ 2022-10-28 14:29 ` zimoun
  0 siblings, 0 replies; 2+ messages in thread
From: zimoun @ 2022-10-28 14:29 UTC (permalink / raw)
  To: Milind Kamble, help-guix

Hi,

Sorry for the late reply.

On sam., 24 sept. 2022 at 18:53, Milind Kamble <milind.b.kamble@gmail.com> wrote:

> ~/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?

Just a naive question because I know nothing about this topic, does it
work if more than lib/avr5 (e.g., avr25, avr, avr31, etc.) is provided
in the search path?


Cheers,
simon


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-28 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24 23:53 microscheme fails to assemble BLINK.ms due to avr-gcc search path issue Milind Kamble
2022-10-28 14:29 ` zimoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).