Bug 27769 - cross-gnatmake needs host gcc
Summary: cross-gnatmake needs host gcc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2006-05-25 16:12 UTC by berndtrog
Modified: 2006-06-06 12:43 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-27 17:09:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description berndtrog 2006-05-25 16:12:33 UTC
$ cat p.gpr
project p is
   for Library_Name use "p";
   for Library_Dir  use "lib";
   for Library_Kind use "static";
end p;

$ cat p.ads
package p is
end;

$ avr-gnatmake -Pp -f -v --RTS=rts/atmega8

Parsing Project File "p".
Checking project file "p"
 5 lines: No errors

Parsing of Project File "p" is finished.

[..]

end of compilation
build library build (RE2)

building static library for project p

object files:
   /src/source/p/p.o

ALI files:
   /src/source/p/p.ali

building a library...
   make p
avr-gnatmake: gcc not found in path
Comment 1 Andrew Pinski 2006-05-25 17:01:32 UTC
This is still not enough info.
I bet a beer at the GCC summit, it is trying to invoke gcc instead of avr-gcc for avr-gnatmake.
Comment 2 Laurent GUERBY 2006-05-25 18:08:55 UTC
I'm unable to build even a C compiler to the avr target, binutils-2.16.1 + newlib-1.13.0 + gcc-4.1.1-prerelease I get:

make[5]: Entering directory `/mnt/data-5-1/guerby/build/avr/newlib/libc/ctype'
/mnt/data-5-1/guerby/build/./gcc/xgcc -B/mnt/data-5-1/guerby/build/./gcc/ -nostdinc -B/mnt/data-5-1/guerby/build/avr/newlib/ -isystem /mnt/data-5-1/guerby/build/avr/newlib/targ-include -isystem /mnt/data-5-1/guerby/gcc-4.1.1-20060517/newlib/libc/include -B/mnt/data-5-1/guerby/install/avr/bin/ -B/mnt/data-5-1/guerby/install/avr/lib/ -isystem /mnt/data-5-1/guerby/install/avr/include -isystem /mnt/data-5-1/guerby/install/avr/sys-include -DPACKAGE=\"newlib\" -DVERSION=\"1.13.0\"  -I. -I../../../../../gcc-4.1.1-20060517/newlib/libc/ctype  -Os -DPREFER_SIZE_OVER_SPEED -mcall-prologues -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES -fno-builtin      -O2 -g -O2  -c ../../../../../gcc-4.1.1-20060517/newlib/libc/ctype/ctype_.c
../../../../../gcc-4.1.1-20060517/newlib/libc/ctype/ctype_.c:91: error: alias definitions not supported in this configuration
make[5]: *** [ctype_.o] Error 1

In my recollection, cross gnatmake were properly calling TARGET-gcc, ie:
http://www.rtems.com/wiki/index.php/RTEMSAda
Comment 3 Andrew Pinski 2006-05-25 18:19:36 UTC
Subject: Re:  cross-gnatmake needs host gcc

> 
> 
> 
> ------- Comment #2 from laurent at guerby dot net  2006-05-25 18:08 -------
> I'm unable to build even a C compiler to the avr target, binutils-2.16.1 +
> newlib-1.13.0 + gcc-4.1.1-prerelease I get:

avr has its own libc and is not supported by newlib.

-- Pinski
Comment 4 Laurent GUERBY 2006-05-25 21:00:11 UTC
Even when removing newlib it fails too:

de -I../../gcc-4.1.1-20060517/gcc/../libcpp/include  -DL_fixunssfsi -c ../../gcc-4.1.1-20060517/gcc/libgcc2.c -o libgcc/./_fixunssfsi.o
../../gcc-4.1.1-20060517/gcc/libgcc2.c: In function '__fixunssfsi':
../../gcc-4.1.1-20060517/gcc/libgcc2.c:1499: internal compiler error: in compute_frame_pointer_to_cfa_displacement, at dwarf2out.c:10446
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for inst

Bernd what version of various items in the toolchain did you use? Did you apply patches?
Comment 5 Andrew Pinski 2006-05-25 21:06:04 UTC
How did you configure the compiler?
Comment 6 Laurent GUERBY 2006-05-25 21:51:17 UTC
TARGET=avr

../gcc-4.1.1-20060517/configure --verbose --disable-nls --enable-languages=c --target=$TARGET --prefix=$INSTALL --with-dwarf2
Comment 7 berndtrog 2006-05-26 11:15:42 UTC
This bug is target independent. 
I see the same behaviour for --target=mingw32.

Workaround (for avr only):
Index: mlib-utl.adb
===================================================================
--- mlib-utl.adb        (revision 114128)
+++ mlib-utl.adb        (working copy)
@@ -38,7 +38,7 @@

    Initialized : Boolean := False;

-   Gcc_Name : constant String := "gcc";
+   Gcc_Name : constant String := "avr-gcc";
    Gcc_Exec : OS_Lib.String_Access;

    Ar_Name    : OS_Lib.String_Access;
Comment 8 Andrew Pinski 2006-05-26 16:59:54 UTC
Woops what did I do to make this assign this to myself.

Anyways I am no way at all working on this.
Comment 9 Laurent GUERBY 2006-05-27 16:32:32 UTC
I just build a mingw32 cross with c,ada from 4.1.1 prerelease (using native Linux c,ada GCC 4.1.0 as base compiler) and it invokes properly ming32-gcc:

$ mingw32-gnatmake -Pp -v

Parsing Project File "p".
Checking project file "p"
 5 lines: No errors

Parsing of Project File "p" is finished.
Adding source directory "/mnt/data-5-1/guerby/tmp".
Adding object directory "/mnt/data-5-1/guerby/tmp".
Adding "p.ads" as if on the command line

GNATMAKE 4.1.1 20060517 (prerelease)
Copyright 1995-2004 Free Software Foundation, Inc.
Main source file: "p.ads".
Library file does not exist for project "p"
Adding "p.ads" to the queue
  "p.ali" being checked ...
  -> "p.ali" missing.
Creating temp file "/mnt/data-5-1/guerby/tmp/GNAT-TEMP-000001.TMP"
Closing configuration file "/mnt/data-5-1/guerby/tmp/GNAT-TEMP-000001.TMP"
mingw32-gcc -c -I- -gnatA /mnt/data-5-1/guerby/tmp/p.ads
Deleting temp configuration file "/mnt/data-5-1/guerby/tmp/GNAT-TEMP-000001.TMP"
End of compilation

building static library for project p

object files:
   /mnt/data-5-1/guerby/tmp/p.o

ALI files:
   /mnt/data-5-1/guerby/tmp/p.ali

building a library...
   make p
found /opt/gcc/4.1.0/bin/gcc
found /usr/bin/ar
found /usr/bin/ranlib
could not delete /mnt/data-5-1/guerby/tmp/lib/libp.a
ar cr /mnt/data-5-1/guerby/tmp/lib/libp.a /mnt/data-5-1/guerby/tmp/p.o
ranlib /mnt/data-5-1/guerby/tmp/lib/libp.a
Copying "/mnt/data-5-1/guerby/tmp/p.ali" to "/mnt/data-5-1/guerby/tmp/lib"

$ 

So this is probably something very specific to your setup. I'm setting the PR in WAITING state since I cannot confirm it without some additional information.
Comment 10 Laurent GUERBY 2006-05-27 17:09:09 UTC
Oops sorry, didn't see that my log show the problem you mentionned (and not the one I imagined), the library building tools of gnatmake when using a project file are indeed looking for and using native tools (it "succeeds" on my machine because I have the native compiler in PATH).

I wrote a patch
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01411.html

It seems to fix the problem:

found /mnt/data-5-1/guerby/install/bin/mingw32-gcc
found /mnt/data-5-1/guerby/install/bin/mingw32-ar
found /mnt/data-5-1/guerby/install/bin/mingw32-ranlib
could not delete /mnt/data-5-1/guerby/tmp/lib/libp.a
mingw32-ar cr /mnt/data-5-1/guerby/tmp/lib/libp.a /mnt/data-5-1/guerby/tmp/p.o
mingw32-ranlib /mnt/data-5-1/guerby/tmp/lib/libp.a
Copying "/mnt/data-5-1/guerby/tmp/p.ali" to "/mnt/data-5-1/guerby/tmp/lib"
Comment 11 Laurent GUERBY 2006-05-27 18:41:26 UTC
Bernd, could you contribute (attach here) your Makefile and ada RTS changes so that Ada build with AVR target succeeds? I see lots of ICE due to the target 8bit-ness while building the Ada RTS so I assume you cut it or disable it somehow.

Thanks in advance,

Laurent
Comment 12 berndtrog 2006-05-28 14:10:53 UTC
> ------- Comment #11 from laurent at guerby dot net  2006-05-27 18:41 -------
> Bernd, could you contribute (attach here) your Makefile and ada RTS changes so
> that Ada build with AVR target succeeds?

Since I don't like to have mutiple copies of the same thing around, I'd
rather provide only a link into AVR-Ada repo.:

http://svn.sourceforge.net/viewcvs.cgi/avr-ada/trunk/patches/
Comment 13 Laurent Guerby 2006-06-06 12:37:38 UTC
Subject: Bug 27769

Author: guerby
Date: Tue Jun  6 12:37:01 2006
New Revision: 114429

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114429
Log:
2006-06-06  Laurent GUERBY  <laurent@guerby.net>

        PR ada/27769
        mlib-utl.adb: Use Program_Name.



Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/mlib-utl.adb

Comment 14 Laurent Guerby 2006-06-06 12:38:21 UTC
Subject: Bug 27769

Author: guerby
Date: Tue Jun  6 12:37:36 2006
New Revision: 114430

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114430
Log:
2006-06-06  Laurent GUERBY  <laurent@guerby.net>

        PR ada/27769
        mlib-utl.adb: Use Program_Name.



Modified:
    branches/gcc-4_1-branch/gcc/ada/ChangeLog
    branches/gcc-4_1-branch/gcc/ada/mlib-utl.adb

Comment 15 Laurent GUERBY 2006-06-06 12:43:14 UTC
Should be fixed now.