Arnaud,

> >  This change (not posted to `gcc-patches' for some reason) has caused a 
> > regression in the form of a build failure with the `riscv-linux-gnu' 
> > target (and for the record the `x86_64-linux-gnu' build/host running GCC 
> > 8.3.0):
> > 
> > ali.adb:34:28: warning: use clause for package "GNAT" has no effect
> > ali.adb:35:28: warning: use clause for package "Dynamic_HTables" has no 
> > effect
> > ali.adb:155:52: "Bucket_Range_Type" is undefined (more references follow)
> > ali.adb:158:27: "Dynamic_Hash_Tables" is undefined
> > ali.adb:173:30: "Sig_Map" is undefined (more references follow)
> > gnatmake: ".../gcc/ada/ali.adb" compilation error
> > make[3]: *** [../gcc-interface/Makefile:469: gnatmake-re] Error 4
> > make[3]: Leaving directory '.../gcc/ada/tools'
> > make[2]: *** [Makefile:216: gnattools-cross] Error 2
> > make[2]: Leaving directory '.../gnattools'
> > make[1]: *** [Makefile:11224: all-gnattools] Error 2
> > 
> > -- that has persisted ever since.
> 
> As documented in https://gcc.gnu.org/install/build.html
> you need a matching native GNAT compiler to build a GNAT cross compiler.

 Hmm, I used to use matching versions of the whole GCC suite for building 
cross-compilers, but that was long ago, up to GCC 4.1, and not with GNAT 
specifically in mind.  I stopped being involved with the Ada frontend in 
any way then until recently.  Having come across this build problem I did 
check <http://gcc.gnu.org/install/> and then 
<http://gcc.gnu.org/install/prerequisites.html> and all I found was:

"  GNAT
          In order to build the Ada compiler (GNAT) you must already have
          GNAT installed because portions of the Ada frontend are written
          in Ada (with GNAT extensions.) Refer to the Ada installation
          instructions for more specific information."

Notice that an earlier "ISO C++98 compiler" section mentions GCC "version 
3.4 or later" as required for building a cross-compiler, so arguably no 
version restriction (including though not limited to requiring the host 
compiler's version to match) being mentioned here may be interpreted as 
none at all (of course the 3.4 requirement for other parts of the compiler 
built alongside still applies).  Which is why I stopped looking further.

 NB I wasn't able to locate "the Ada installation instructions" referred.

> If I understood properly, you are using a GCC 8.3.0 as the host compiler
> to build a GNAT cross compiler, which indeed won't work: you need to first
> build a native matching compiler and then use this matching compiler to build
> the cross.

 Thanks for the hint.  I have now successfully natively bootstrapped 
current GCC trunk using my usual `--enable-languages=all' setting, and 
then used that `x86_64-linux-gnu' compiler suite to build my original 
`riscv-linux-gnu' cross-compilation environment.  I guess I'll have to 
wire a preparatory native build stage into my setup somehow.  Sorry about 
the noise.

 Perhaps it would make sense to make the prerequisites section of the 
installation instructions a little bit more explicit about the strict 
version match requirement though?  I guess someone being new to a GCC 
build would go through the whole document and then find this:

"  In order to build GNAT, the Ada compiler, you need a working GNAT
   compiler (GCC version 4.0 or later). This includes GNAT tools such as
   gnatmake and gnatlink, since the Ada front end is written in Ada and
   uses some GNAT-specific extensions."

and than that:

"  In order to build a cross compiler, it is suggested to install the new
   compiler as native first, and then use it to build the cross compiler."

buried in the build section.  Still I think the former paragraph really 
belongs to the prerequisites section and so does the latter, perhaps with 
a change to make it more explicit that building a cross-compiler may not 
actually work if the versions do not match.  WDYT?

 NB I have no specific interest in the Ada frontend.  Rather I want to 
have all the frontends built and included in testing so that when making 
changes any regressions trigger that would not with, say, the C frontend 
only.

  Maciej

Reply via email to