From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: avr-gcc Date: Wed, 18 Nov 2015 20:54:23 -0500 Message-ID: References: <87wptgmyv1.fsf@elephly.net> <87twoks459.fsf@gnu.org> <87a8qbr2mb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzEQb-0007OU-AG for guix-devel@gnu.org; Wed, 18 Nov 2015 20:54:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzEQa-0007YG-4h for guix-devel@gnu.org; Wed, 18 Nov 2015 20:54:25 -0500 Received: from mail-yk0-x22b.google.com ([2607:f8b0:4002:c07::22b]:34397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzEQZ-0007Xx-Um for guix-devel@gnu.org; Wed, 18 Nov 2015 20:54:24 -0500 Received: by ykfs79 with SMTP id s79so92791385ykf.1 for ; Wed, 18 Nov 2015 17:54:23 -0800 (PST) In-Reply-To: <87a8qbr2mb.fsf@gnu.org> 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: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: "guix-devel@gnu.org" On Wed, Nov 18, 2015 at 6:03 AM, Ludovic Court=C3=A8s wrote: > "Thompson, David" skribis: > >> On Tue, Nov 17, 2015 at 4:32 PM, Ludovic Court=C3=A8s wro= te: > > [...] > >>> In GCC we modify the spec file so that the right -L/libc/dir/name is >>> passed to ld; see (gnu packages gcc), =E2=80=98GNU_USER_TARGET_LIB_SPEC= =E2=80=99. >>> >>> However, =E2=80=98gcc-cross-sans-libc-avr=E2=80=99 is a bare-bones comp= iler, so it >>> doesn=E2=80=99t get the -L flag in question since there=E2=80=99s no li= bc to link to. >>> >>> To get a full-blow compiler that uses avr-libc, you could start from >>> this: >>> >>> >>> >>> =E2=80=A6 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=3D? 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=3D? "avr-libc" (package-name libc)) >> `() >> `(("xlinux-headers" ;the target headers >> ,@(assoc-ref (package-propagated-inputs li= bc) >> "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=E2=80=99s not clear to me how as a user you=E2=80=99re su= pposed 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 =E2=80=98CROSS_LIBRARY_PA= TH=E2=80=99 > 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=E2=80=99t know = if it=E2=80=99s > how it=E2=80=99s 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"))) > > =E2=80=98C_INCLUDE_PATH=E2=80=99 is the C-only equivalent of =E2=80=98CPA= TH=E2=80=99. Our > cross-compiler honors =E2=80=98CROSS_CPATH=E2=80=99 instead of =E2=80=98C= PATH=E2=80=99 so as to > distinguish between host and build headers (see > gcc-cross-environment-variables.patch.) Ah, okay. CROSS_CPATH works. > Also it=E2=80=99s not clear to me why avr-libc installs things in avr/inc= lude > instead of include/. Not sure either, but it poses no problem. > So in short, it looks like everything you need is already there, but the > pieces need to be wired together. :-) Not quite. The avr-gcc build only provides a single version of libgcc.a, whereas Debian's avr-gcc provides a separate libgcc.a for each supported AVR family (avr2, avr3, avr35, etc.) Mark thought it might be the fault of the --disable-multilib configure flag, so I removed it but it didn't solve anything. I'm not sure what to do now. I have no idea what flag or patch could be signalling to the gcc build system that it shouldn't try to compile libraries for all of the various AVR models. Does anyone have any ideas? Thanks, - Dave