guix-devel
[Top][All Lists]
Advanced

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

Re: avr-gcc


From: Ludovic Courtès
Subject: Re: avr-gcc
Date: Tue, 17 Nov 2015 22:32:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Ricardo Wurmus <address@hidden> skribis:

> 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

If needed, you could add one such package to ‘cross-base.scm’.
Currently there are only full-blown cross-GCCs there, but if adding a
cross-binutils is useful, go for it.

> 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

In GCC we modify the spec file so that the right -L/libc/dir/name is
passed to ld; see (gnu packages gcc), ‘GNU_USER_TARGET_LIB_SPEC’.

However, ‘gcc-cross-sans-libc-avr’ is a bare-bones compiler, so it
doesn’t get the -L flag in question since there’s no libc to link to.

To get a full-blow compiler that uses avr-libc, you could start from
this:

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index d59816b..8e9f172 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -53,6 +53,13 @@
 for use with GCC on Atmel AVR microcontrollers.")
     (license (license:non-copyleft 
"http://www.nongnu.org/avr-libc/LICENSE.txt";))))
 
+(define-public xgcc-avr-avrlibc
+  ;; AVR cross-compiler, used to build AVR-Libc.
+  (let ((triplet "avr-linux-avrlibc"))
+    (cross-gcc triplet
+               (cross-binutils triplet)
+               avr-libc)))
+
 (define-public microscheme
   (package
     (name "microscheme")
… and then address any glibc assumptions you encounter.

> 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?).

Maybe microsheme should have avr-gcc and avr-libc as propagated inputs
or something like that?

HTH,
Ludo’.

reply via email to

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