Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 720698

Summary: dev-util/perf calls gcc directly ( /bin/sh: gcc: command not found )
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Naohiro Aota <naota>
Severity: normal CC: amadio, dlan, kentnl, slyfox
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 243502    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2020-05-02 19:03:07 UTC
This is an auto-filled bug because dev-util/perf calls cc directly.
The issue was originally discovered on arm64, but it may be reproducible on other arches as well.
If you think that a different summary clarifies the issue better, feel free to change it.
Attached build log and emerge --info.

If you think it doesn't make sense fix these type of issues, I'd like to point out that won't be possible use a different CC implementation (like clang) by setting the CC variable. So this issue has been reproduced by setting the CC variable to aarch64-unknown-linux-gnu-gcc and by removing the /usr/bin/cc - /usr/bin/gcc binaries.
Comment 1 Agostino Sarubbo gentoo-dev 2020-05-02 19:03:18 UTC
Created attachment 635722 [details]

build log and emerge --info
Comment 2 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2020-05-22 15:40:47 UTC
>> Compiling source in /var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/perf ...
make -j96 V=1 VF=1 CC=aarch64-unknown-linux-gnu-gcc CXX=aarch64-unknown-linux-gnu-g++ AR=aarch64-unknown-linux-gnu-ar LD=aarch64-unknown-linux-gnu-ld prefix=/usr bindir_relative=bin 'EXTRA_CFLAGS=-O2 -pipe -march=native -g -ggdb -frecord-gcc-switches' ARCH=arm64 JDIR= LIBCLANGLLVM= NO_AUXTRACE= NO_BACKTRACE= NO_CORESIGHT=1 NO_DEMANGLE= NO_GTK2=no NO_JVMTI=no NO_LIBAUDIT=no NO_LIBBABELTRACE=1 NO_LIBBIONIC=1 NO_LIBBPF= NO_LIBCRYPTO= NO_LIBDW_DWARF_UNWIND= NO_LIBELF= NO_LIBNUMA=no NO_LIBPERL=no NO_LIBPYTHON=no NO_LIBUNWIND=no NO_SDT=no NO_SLANG=no NO_LZMA=no NO_ZLIB= WERROR=0 LIBDIR=/usr/libexec/perf-core -f Makefile.perf 
make -C /var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build CFLAGS= LDFLAGS= fixdep
make[1]: Entering directory '/var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build'
make -f /var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build/ dir=. obj=fixdep
  gcc -Wp,-MD,./.fixdep.o.d -Wp,-MT,fixdep.o  -D"BUILD_STR(s)=#s"   -c -o fixdep.o fixdep.c
/bin/sh: gcc: command not found
cat: ./.fixdep.o.d: No such file or directory
make[2]: *** [/var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build/ fixdep.o] Error 1
make[1]: *** [Makefile:43: fixdep-in.o] Error 2
make[1]: Leaving directory '/var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build'
make: *** [/var/tmp/portage/dev-util/perf-5.6.4/work/linux-5.6/tools/build/Makefile.include:5: fixdep] Error 2
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-30 14:18:48 UTC
Probably similar to bug #725878 where kernel-2.eclass was not setting HOSTCC. perf might need a bit more tweaking.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-30 16:17:45 UTC
Looks like the only things needed are:
- NM

This patch gives me perf:

--- a/dev-util/perf/perf-5.6.14.ebuild
+++ b/dev-util/perf/perf-5.6.14.ebuild
@@ -153,7 +153,8 @@ perf_make() {
 	emake V=1 VF=1 \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" \
+		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
+		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
 		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
 		prefix="${EPREFIX}/usr" bindir_relative="bin" \
Comment 5 Larry the Git Cow gentoo-dev 2020-06-12 23:02:59 UTC
The bug has been closed via the following commit(s):

commit aec008bcfbd1bb4891d70e23f7857cbb3b9e8d88
Author:     Sergei Trofimovich <>
AuthorDate: 2020-06-12 23:02:49 +0000
Commit:     Sergei Trofimovich <>
CommitDate: 2020-06-12 23:02:54 +0000

    dev-util/perf: use user's CC in HOSTCC and friends
    Reported-by: Agostino Sarubbo
    Package-Manager: Portage-2.3.100, Repoman-2.3.22
    Signed-off-by: Sergei Trofimovich <>

 dev-util/perf/perf-5.7-r1.ebuild | 237 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 237 insertions(+)