Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643106 - kernel-2.eclass ignores CC environment variable when compiling headers
Summary: kernel-2.eclass ignores CC environment variable when compiling headers
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
: 643104 (view as bug list)
Depends on:
Blocks: tc-directly
  Show dependency tree
 
Reported: 2018-01-02 13:01 UTC by Bjorn Pagen
Modified: 2021-08-23 18:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjorn Pagen 2018-01-02 13:01:44 UTC
Even though my CC=clang, compilation for sys-kernel/linux-headers-4.14:0/0::musl fails because it tries to call gcc, which doesn't exist. I am experimenting with a clang-only system, where gcc is not installed.
Comment 1 Bjorn Pagen 2018-01-02 13:02:18 UTC
partridge /usr/local/hack/stage4 # emerge --info
!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.
Portage 2.3.19 (python 3.5.4-final-0, default/linux/musl/amd64, [unavailable], musl-1.1.18, 4.14.9-ck x86_64)
=================================================================
System uname: Linux-4.14.9-ck-x86_64-Intel-R-_Core-TM-_i7-6560U_CPU_@_2.20GHz-with-gentoo-2.4.1
KiB Mem:    16267708 total,   5843276 free
KiB Swap:          0 total,         0 free
Head commit of repository gentoo: 7675026aa7867fd9d5bf678e3206c3261a473205

Head commit of repository libressl: a381c149425239cb95e111c96e54baddc0b61e02

Head commit of repository musl: 979bcc40649dac76bc7cdb64d2a662dd82a00c75

sh bash 4.4_p12
ld LLD 5.0.1 (compatible with GNU linkers)
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo
dev-util/cmake:           3.10.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.12::musl
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.14::musl (virtual/os-headers)
sys-libs/musl:            1.1.18::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo/gentoo
    priority: -1000

libressl
    location: /usr/local/portage/libressl
    sync-type: git
    sync-uri: https://github.com/gentoo/libressl
    masters: gentoo
    priority: 400

musl
    location: /usr/local/portage/musl
    sync-type: git
    sync-uri: https://github.com/gentoo/musl
    masters: gentoo
    priority: 500

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-gentoo-linux-musl"
CC="clang"
CFLAGS="-O3 -pipe -flto"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXX="clang++"
CXXFLAGS="-O3 -pipe -flto"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--strip-all"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="amd64 cli cracklib crypt cxx default-compiler-rt default-libcxx dri fortran iconv ipv6 libcxx libcxxabi libressl modules ncurses nls nptl openmp pam pcre readline seccomp session ssl tcpd unicode xattr zlib" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Bjorn Pagen 2018-01-02 13:03:39 UTC
partridge /usr/local/hack/stage4 # emerge -1av linux-headers

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-kernel/linux-headers-4.14::musl  0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] yes

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-kernel/linux-headers-4.14::musl
 * gentoo-headers-base-4.14.tar.xz BLAKE2B SHA512 size ;-) ...           [ ok ]
 * gentoo-headers-4.14-1.tar.xz BLAKE2B SHA512 size ;-) ...              [ ok ]
>>> Unpacking source...
>>> Unpacking gentoo-headers-base-4.14.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-4.14/work
>>> Unpacking gentoo-headers-4.14-1.tar.xz to /var/tmp/portage/sys-kernel/linux-headers-4.14/work
>>> Source unpacked in /var/tmp/portage/sys-kernel/linux-headers-4.14/work
>>> Preparing source in /var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14 ...
 * Applying various patches (bugfixes/updates) ...
 *   00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch ...          [ ok ]
 *   00_all_0002-netfilter-pull-in-limits.h.patch ...                    [ ok ]
 *   00_all_0003-convert-PAGE_SIZE-usage.patch ...                       [ ok ]
 *   00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch [ ok ]
 *   00_all_0005-unifdef-drop-unused-errno.h-include.patch ...           [ ok ]
 *   00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.pa [ ok ]
 *   00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch . [ ok ]
 *   00_all_0008-uapi-fix-System-V-buf-header-includes.patch ...         [ ok ]
 * Done with patching
 * Applying libc-4.8-portability.patch ...                               [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14 ...
>>> Source compiled.
>>> Test phase [not enabled]: sys-kernel/linux-headers-4.14

>>> Install linux-headers-4.14 into /var/tmp/portage/sys-kernel/linux-headers-4.14/image/ category sys-kernel
make -j4 headers_install INSTALL_HDR_PATH=/var/tmp/portage/sys-kernel/linux-headers-4.14/image//usr/include/.. ARCH=x86 CROSS_COMPILE=x86_64-gentoo-linux-musl- 
getconf: LFS_CFLAGS: unknown variable
getconf: LFS_LDFLAGS: unknown variable
getconf: LFS_LIBS: unknown variable
./scripts/gcc-version.sh: line 26: x86_64-gentoo-linux-musl-gcc: command not found
./scripts/gcc-version.sh: line 27: x86_64-gentoo-linux-musl-gcc: command not found
make: x86_64-gentoo-linux-musl-gcc: Command not found
make: x86_64-gentoo-linux-musl-gcc: Command not found
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
make: x86_64-gentoo-linux-musl-gcc: Command not found
make: x86_64-gentoo-linux-musl-gcc: Command not found
make: x86_64-gentoo-linux-musl-gcc: Command not found
  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
make: x86_64-gentoo-linux-musl-gcc: Command not found
  HOSTCC  scripts/unifdef
/bin/sh: gcc: command not found
make[1]: *** [scripts/Makefile.host:102: scripts/unifdef] Error 127
make: *** [Makefile:1153: __headers] Error 2
 * ERROR: sys-kernel/linux-headers-4.14::musl failed (install phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-kernel/linux-headers-4.14::musl'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/linux-headers-4.14::musl'`.
 * The complete build log is located at '/var/tmp/portage/sys-kernel/linux-headers-4.14/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/linux-headers-4.14/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14'
 * S: '/var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14'
 * QA Notice: command not found:
 * 
 *      ./scripts/gcc-version.sh: line 26: x86_64-gentoo-linux-musl-gcc: command not found
 *      ./scripts/gcc-version.sh: line 27: x86_64-gentoo-linux-musl-gcc: command not found

>>> Failed to emerge sys-kernel/linux-headers-4.14, Log file:

>>>  '/var/tmp/portage/sys-kernel/linux-headers-4.14/temp/build.log'

 * Messages for package sys-kernel/linux-headers-4.14:

 * ERROR: sys-kernel/linux-headers-4.14::musl failed (install phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-kernel/linux-headers-4.14::musl'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/linux-headers-4.14::musl'`.
 * The complete build log is located at '/var/tmp/portage/sys-kernel/linux-headers-4.14/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/linux-headers-4.14/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14'
 * S: '/var/tmp/portage/sys-kernel/linux-headers-4.14/work/gentoo-headers-base-4.14'
Comment 3 Felix Janda 2018-01-02 19:40:26 UTC
The ebuild in the musl overlay has just one additional patch. So this
bug should also apply to the main repository.

The main cause for this bug seems that the upstream kernel build system
ignores user specified CC (and has hardcoded gcc).
Comment 4 Bjorn Pagen 2018-01-02 20:04:06 UTC
*** Bug 643104 has been marked as a duplicate of this bug. ***
Comment 5 Mike Pagano gentoo-dev 2021-08-23 18:45:25 UTC
I changed my CC to clang and had no issues.  If I am missing something and this is still an issue,  please re-open.

>>> Install sys-kernel/linux-headers-5.10 into /var/tmp/portage/sys-kernel/linux-headers-5.10/image/
make -j14 headers_install INSTALL_HDR_PATH=/var/tmp/portage/sys-kernel/linux-headers-5.10/image/usr/include/.. ARCH=x86 CROSS_COMPILE=x86_64-pc-linux-gnu- HOSTCC=clang