For some reason, presumably historical, the `install-gnatlib' target for the default multilib is invoked twice, once via the `ada.install-common' target in `gcc/ada/gcc-interface/Make-lang.in' invoked from gcc/ and again via the `install-libada' target in libada/.
Apart from doing the same twice this is actually harmful in sufficiently parallelized `make' invocation, as the removal of old files performed within the `install-gnatlib' recipe in the former case actually races with the installation of new files done in the latter case, causing the recipe to fail and abort, however non-fatally, having not completed the installation of all the built files needed for the newly-built compiler to work correctly.
This can be observed with a native `x86_64-linux-gnu' bootstrap:
make: Entering directory '.../gcc/ada' rm -rf .../lib/gcc/x86_64-linux-gnu/10.0.0/adalib rm: cannot remove '.../lib/gcc/x86_64-linux-gnu/10.0.0/adalib': Directory not empty make: *** [gcc-interface/Makefile:512: install-gnatlib] Error 1 make: Leaving directory '.../gcc/ada' make: *** [.../gcc/ada/gcc-interface/Make-lang.in:853: install-gnatlib] Error 2 make: [.../gcc/ada/gcc-interface/Make-lang.in:829: ada.install-common] Error 2 (ignored)
which then causes missing files to be reported when an attempt is made to use the newly-installed non-functional compiler to build a `riscv-linux-gnu' cross-compiler:
(cd ada/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h ) error: "ada.ali" not found, "ada.ads" must be compiled error: "s-memory.ali" not found, "s-memory.adb" must be compiled gnatmake: *** bind failed. /bin/sh: ./xsinfo: No such file or directory make: *** [.../gcc/ada/Make-generated.in:45: ada/sinfo.h] Error 127 make: Leaving directory '.../gcc' make: *** [Makefile:4369: all-gcc] Error 2 make: Leaving directory '...' make: *** [Makefile:965: all] Error 2
Depending on timing `.../lib/gcc/x86_64-linux-gnu/10.0.0/adainclude' may cause an installation failure instead and the resulting compiler may be non-functional in a different way.
Only invoke `install-gnatlib' from within gcc/ then if a legacy build process is being used with libada disabled and gnatlib built manually with `make -C gcc gnatlib'.
- Makefile.in (gnat_install_lib): New variable.
- configure.ac: Substitute it.
- configure: Regenerate.
- gcc-interface/Make-lang.in (ada.install-common): Split into... (gnat-install-tools, gnat-install-lib): ... these.
ac4a0fc03bc libada: Remove racy duplicate gnatlib installation
gcc/ChangeLog | 6 ++++++
gcc/Makefile.in | 4 ++++
gcc/ada/ChangeLog | 5 +++++
gcc/ada/gcc-interface/Make-lang.in | 5 ++++-
gcc/configure | 15 +++++++++++++--
gcc/configure.ac | 10 ++++++++++
6 files changed, 42 insertions(+), 3 deletions(-)