Created attachment 48305 [details]
Initially reported by Agostino Sarubbo as https://bugs.gentoo.org/718004.
There Gentoo builds gcc-9.3.0 as:
and observes 'ar' being called by libcpp. It should be 'x86_64-pc-linux-gnu-ar' instead.
libcpp/Makefile.in hardcodes 'AR = ar' (but does not hardcode RANLIB for example: 'RANLIB = @RANLIB@').
A few other tools do it:
$ git grep 'AR = ar' | cat
gcc/ada/gcc-interface/Makefile.in:AR = ar
intl/Makefile.in:AR = ar
libcpp/Makefile.in:AR = ar
libdecnumber/Makefile.in:AR = ar
but only libcpp refers 'ar' and fails build when 'ar' does not exist:
ar cru libcpp.a charset.o directives.o directives-only.o errors.o expr.o files.o identifiers.o init.o lex.o line-map.o macro.o mkdeps.o pch.o symtab.o traditional.o
/bin/bash: ar: command not found
Attached patch adds AR detection similar to other libraries.
But maybe it should be set in top-level Makefile?
please submit the patch to the gcc-patches mailing list for review
Sent as https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544379.html
(In reply to Sergei Trofimovich from comment #2)
> Sent as https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544379.html
thanks, adding the "patch" keyword
On #gcc Tobias pointed out that similar patch was merged a few days ago: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=731c4ce0e93065fb70db5faa2bd6c9c6bad56738