https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94657
Bug ID: 94657 Summary: [patch] libcpp uses 'AR = ar' tool even if --build/--host are passed explicitly. Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru Target Milestone: --- Created attachment 48305 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48305&action=edit libcpp-ar.patch Initially reported by Agostino Sarubbo as https://bugs.gentoo.org/718004. There Gentoo builds gcc-9.3.0 as: --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu 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?