[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avr-gcc
From: |
Ludovic Courtès |
Subject: |
Re: avr-gcc |
Date: |
Wed, 18 Nov 2015 12:03:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Thompson, David" <address@hidden> skribis:
> On Tue, Nov 17, 2015 at 4:32 PM, Ludovic Courtès <address@hidden> wrote:
[...]
>> 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:
>>
>>
>>
>> … and then address any glibc assumptions you encounter.
>
> I tried to do this, but I don't really know what I'm doing. The first
> problem I encountered was that I needed to add a case to the
> 'glibc-dynamic-linker' procedure in (gnu packages bootstrap). I
> didn't know what ld was needed, if any, so I added this case:
>
> ((string=? system "avr-avrlibc") "no-ld.so")
It may be that avr-libc has no dynamic linker, because it targets
MMU-less systems, no?
> Then, the issue was that avr-libc doesn't have a propagated input with
> the label "linux-headers", as required by 'cross-gcc' in (gnu packages
> cross-base). So, as a hack I tried something like this:
>
> (if (string=? "avr-libc" (package-name libc))
> `()
> `(("xlinux-headers" ;the target headers
> ,@(assoc-ref (package-propagated-inputs libc)
> "linux-headers"))))
>
> Now I was able to get the build process to start, but it failed when
> trying to compile binutils:
>
> checking target system type... Invalid configuration
> `avr-linux-avrlibc': system `avrlibc' not recognized
>
> I'm totally lost. Any thoughts on where to go next?
Hmm, maybe my suggestion was just misguided, because the AVR environment
seems to be very different from the typical GNU/Linux environment.
For instance it’s not clear to me how as a user you’re supposed to tell
the compiler which libc.a file to choose among all those provided by
avr-libc.
Back to the Microscheme question, you could set ‘CROSS_LIBRARY_PATH’
manually to point to one of the avr/lib/xxx directories, where our
cross-gcc will find libc.a, libm.a, and crt*.o, but I don’t know if it’s
how it’s intended to work.
> BTW, I believe this native search path is needed in order for the AVR
> header files to be found:
>
> (search-path-specification
> (variable "C_INCLUDE_PATH")
> (files '("avr/include")))
‘C_INCLUDE_PATH’ is the C-only equivalent of ‘CPATH’. Our
cross-compiler honors ‘CROSS_CPATH’ instead of ‘CPATH’ so as to
distinguish between host and build headers (see
gcc-cross-environment-variables.patch.)
Also it’s not clear to me why avr-libc installs things in avr/include
instead of include/.
So in short, it looks like everything you need is already there, but the
pieces need to be wired together. :-)
Ludo’.
- avr-gcc, Ricardo Wurmus, 2015/11/17