From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: avr-gcc Date: Wed, 18 Nov 2015 12:03:24 +0100 Message-ID: <87a8qbr2mb.fsf@gnu.org> References: <87wptgmyv1.fsf@elephly.net> <87twoks459.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]:58172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz0WS-0002EV-SU for guix-devel@gnu.org; Wed, 18 Nov 2015 06:03:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz0WO-0002LY-Ud for guix-devel@gnu.org; Wed, 18 Nov 2015 06:03:32 -0500 In-Reply-To: (David Thompson's message of "Tue, 17 Nov 2015 22:53:31 -0500") 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: "Thompson, David" Cc: "guix-devel@gnu.org" "Thompson, David" skribis: > On Tue, Nov 17, 2015 at 4:32 PM, Ludovic Court=C3=A8s wrot= e: [...] >> 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 compi= ler, so it >> doesn=E2=80=99t get the -L flag in question since there=E2=80=99s no lib= c 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 lib= c) > "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 supp= osed 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_PATH= =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=98CPATH= =E2=80=99. Our cross-compiler honors =E2=80=98CROSS_CPATH=E2=80=99 instead of =E2=80=98CPA= TH=E2=80=99 so as to distinguish between host and build headers (see gcc-cross-environment-variables.patch.) Also it=E2=80=99s not clear to me why avr-libc installs things in avr/inclu= de instead of include/. So in short, it looks like everything you need is already there, but the pieces need to be wired together. :-) Ludo=E2=80=99.