comp.lang.ada
 help / color / mirror / Atom feed
* Please help... troubleshooting Gnat AVR build
@ 2009-06-21 16:19 Steve D
  2009-06-22  9:57 ` Stephen Leake
  0 siblings, 1 reply; 4+ messages in thread
From: Steve D @ 2009-06-21 16:19 UTC (permalink / raw)


I'm trying to build Gnat for AVR following the instructions on the AVR-Ada 
site using the build scrpt described at:
http://avr-ada.wiki.sourceforge.net/BuildScript

I'm using XP on a Virtual Box VM so I have tight control over the 
environment (without messing up my main system).  It also allows me to start 
clean so that when I'm done I should be able to make correct instructions 
for the next guy.

I installed GnatGPL 2009 to do the build.

There were a number of errors in the Gnat source code that were identified 
by the 2009 compiler, and I put togther a patch file that fixes the sources, 
so the compiler builds.

If I understand correctly I am successfully creating a compiler but getting
a failure when building the AVR-Ada libs.

Looking at the log file for step 13 I have a bunch of lines like:

avr-gcc -c -g -Os -gnatn -gnatpg -mmcu=at90can128 -I- -Iadainclude
adainclude/s-bitops.adb
cp s-bitops.o adalib
avr-gcc -c -g -Os -gnatn -gnatpg -mmcu=at90can128 -I- -Iadainclude
adainclude/ada.ads
cp ada.ali adalib
avr-gcc -c -g -Os -gnatn -gnatpg -mmcu=at90can128 -I- -Iadainclude
adainclude/interfac.ads
...

Which makes me think that the compiler basically works.

But in the step 14 log file I have:

avr-gcc -c -gnatec=C:\AVR-ADA\build\avr-ada-1.0.2\avr\gnat.adc -gdwarf-2 -gnatwp
 -gnatwu -gnatn -gnatp -gnatVn -Os -gnatef -fverbose-asm -frename-registers
-mmcu=at90can128 -fdata-sections -ffunction-sections --RTS=rts/at90can128 -I-
 -gnatA C:\AVR-ADA\build\avr-ada-1.0.2\avr\avr_lib\at90can128\avr-mcu.ads
avr-gnatmake: "avr-mcu.ali" incompatible ALI file, please recompile

I found the source of the error message in the file: make.adb

                  ALI :=
                    Scan_ALI (Lib_File, Text, Ignore_ED => False, Err => 
True);

                  if ALI = No_ALI_Id then

                     --  Record a failure only if not already done

                     if Compilation_OK then
                        Inform
                          (Lib_File,
                           "incompatible ALI file, please recompile");
                        Record_Failure (Full_Source_File, Source_Unit);
                     end if;
                  else

The function Scan_ALI is located in ali.adb.

I looked at the .ali file
C:\AVR-ADA\build\avr-ada-1.0.2\avr\avr_lib\at90can128\obj\avr-mcu.ali and
walked through the source code of Scan_ALI by hand until I get to the line:

R rnnnnnnnnnrnrrnrnnrrnnrnnnnnrrnrnnrnnrrnnnrnrrnnvrrrrnvvnnrnnnnnnnnnnr1nnn

This line encodes the set of "restrictions" for the compiler.  The format of
this line is described in lib-writ.ads.

The first 23 characters (if I counted correctly, which I did several times) 
are
"All_Boolean_Restrictions" which are defined in restrict.ads.

Following the first 23 chars what I should find is a bunch of two part
sequences where the first part of the sequence is either the letter 'n' or
the letter 'r' followed by some number of digits (a natural number) and the
second letter is either the letter 'n' or the letter 'v' followed by some
number of digits (a natural number).

Breaking that original line down to separate the sequences, you can see that
in the 3rd sequence the second character is a r, which is (my best guess)
what is causing the error.

R rnnnnnnnnnrnrrnrnnrrnnr nn nn nr rn rn nr
nnrrnnnrnrrnnvrrrrnvvnnrnnnnnnnnnnr1nnn

The gnat compiler (gnat1drv) uses the function Write_ALI in lib-writ.adb to
write the .ali file and around line 1025 writes the series of pairs.  I
cannot see a way that the sequence I'm seeing could be generated by this
code.

Can anyone please point me in the right direction?  I'm stuck.

Thanks,
Steve




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Please help... troubleshooting Gnat AVR build
  2009-06-21 16:19 Please help... troubleshooting Gnat AVR build Steve D
@ 2009-06-22  9:57 ` Stephen Leake
  2009-06-25  2:12   ` Steve D
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2009-06-22  9:57 UTC (permalink / raw)


"Steve D" <nospam_steved94@comcast.net> writes:

> But in the step 14 log file I have:
>
> avr-gcc -c -gnatec=C:\AVR-ADA\build\avr-ada-1.0.2\avr\gnat.adc -gdwarf-2 -gnatwp
> -gnatwu -gnatn -gnatp -gnatVn -Os -gnatef -fverbose-asm -frename-registers
> -mmcu=at90can128 -fdata-sections -ffunction-sections --RTS=rts/at90can128 -I-
> -gnatA C:\AVR-ADA\build\avr-ada-1.0.2\avr\avr_lib\at90can128\avr-mcu.ads
> avr-gnatmake: "avr-mcu.ali" incompatible ALI file, please recompile

I get this when I first compile with one version of GNAT, and then
compile in the same directory with a later version of GNAT. The
solution in that case is to delete all .ali files, and start again
with the right compiler.

I know you said you have tight control over the environment, but maybe
check again? At least make sure you have no .ali files around when you
start compiling.

Maybe you're mixing the cross compiler ali files with the native ones?

Otherwise, you've found a compiler bug.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Please help... troubleshooting Gnat AVR build
  2009-06-22  9:57 ` Stephen Leake
@ 2009-06-25  2:12   ` Steve D
  2009-06-25 11:31     ` John B. Matthews
  0 siblings, 1 reply; 4+ messages in thread
From: Steve D @ 2009-06-25  2:12 UTC (permalink / raw)


"Stephen Leake" <stephen_leake@stephe-leake.org> wrote in message 
news:u1vpcoaka.fsf@stephe-leake.org...
> "Steve D" <nospam_steved94@comcast.net> writes:
>
>> But in the step 14 log file I have:
>>
>> avr-gcc -c -gnatec=C:\AVR-ADA\build\avr-ada-1.0.2\avr\gnat.adc -gdwarf-2  
>> -gnatwp
>> -gnatwu -gnatn -gnatp -gnatVn -Os -gnatef -fverbose-asm -frename-registers
>> -mmcu=at90can128 -fdata-sections -ffunction-sections --RTS=rts/at90can128 
>>  -I-
>> -gnatA C:\AVR-ADA\build\avr-ada-1.0.2\avr\avr_lib\at90can128\avr-mcu.ads
>> avr-gnatmake: "avr-mcu.ali" incompatible ALI file, please recompile
>
> I get this when I first compile with one version of GNAT, and then
> compile in the same directory with a later version of GNAT. The
> solution in that case is to delete all .ali files, and start again
> with the right compiler.
>
> I know you said you have tight control over the environment, but maybe
> check again? At least make sure you have no .ali files around when you
> start compiling.
>
> Maybe you're mixing the cross compiler ali files with the native ones?
>

Do you know (by chance) how Gnat chooses the locations to include in the 
build (outside of the -I directives in the command line)?

For example: if I write a simple native (non-cross) "Hello, world" program, 
the compiler doesn't have any trouble finding Ada.Text_IO with nothing extra 
specified on the command line.  Is there some kind of an "nostdinc" fo Ada?

TIA,
Steve


> Otherwise, you've found a compiler bug.
>
> -- 
> -- Stephe





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Please help... troubleshooting Gnat AVR build
  2009-06-25  2:12   ` Steve D
@ 2009-06-25 11:31     ` John B. Matthews
  0 siblings, 0 replies; 4+ messages in thread
From: John B. Matthews @ 2009-06-25 11:31 UTC (permalink / raw)


In article <w2B0m.54762$gz5.49141@newsfe07.iad>,
 "Steve D" <nospam_steved94@comcast.net> wrote:

> "Stephen Leake" <stephen_leake@stephe-leake.org> wrote in message 
> news:u1vpcoaka.fsf@stephe-leake.org...
> > "Steve D" <nospam_steved94@comcast.net> writes:
> >
> >> But in the step 14 log file I have:
> >>
> >> avr-gcc -c -gnatec=C:\AVR-ADA\build\avr-ada-1.0.2\avr\gnat.adc 
> >> -gdwarf-2  -gnatwp -gnatwu -gnatn -gnatp -gnatVn -Os -gnatef 
> >> -fverbose-asm -frename-registers -mmcu=at90can128 -fdata-sections 
> >> -ffunction-sections --RTS=rts/at90can128 -I- -gnatA 
> >> C:\AVR-ADA\build\avr-ada-1.0.2\avr\avr_lib\at90can128\avr-mcu.ads 
> >> avr-gnatmake: "avr-mcu.ali" incompatible ALI file, please 
> >> recompile
> >
> > I get this when I first compile with one version of GNAT, and then 
> > compile in the same directory with a later version of GNAT. The 
> > solution in that case is to delete all .ali files, and start again 
> > with the right compiler.
> >
> > I know you said you have tight control over the environment, but 
> > maybe check again? At least make sure you have no .ali files around 
> > when you start compiling.
> >
> > Maybe you're mixing the cross compiler ali files with the native 
> > ones?
> 
> Do you know (by chance) how Gnat chooses the locations to include in 
> the build (outside of the -I directives in the command line)?
> 
> For example: if I write a simple native (non-cross) "Hello, world" 
> program, the compiler doesn't have any trouble finding Ada.Text_IO 
> with nothing extra specified on the command line.

Look for section "3.3 Search Paths and the Run-Time Library (RTL)".*

> Is there some kind of an "nostdinc" fo Ada?

Both -nostdinc & -nostdlib are recognized by gnatmake.*

*<http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gnat_ugn_unw/>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-25 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-21 16:19 Please help... troubleshooting Gnat AVR build Steve D
2009-06-22  9:57 ` Stephen Leake
2009-06-25  2:12   ` Steve D
2009-06-25 11:31     ` John B. Matthews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox