In file included from <stdin>:1: /usr/include/libelf/libelf.h:28:5: error: "__LIBELF_INTERNAL__" is not defined, evaluates to 0 [-Werror=undef] #if __LIBELF_INTERNAL__ ^~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors HOSTCC /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep.o HOSTLD /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep-in.o LINK /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep CC /usr/src/linux-5.0.7-gentoo/tools/objtool/exec-cmd.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/help.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/pager.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/parse-options.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/run-command.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/sigchain.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/subcmd-config.o LD /usr/src/linux-5.0.7-gentoo/tools/objtool/libsubcmd-in.o AR /usr/src/linux-5.0.7-gentoo/tools/objtool/libsubcmd.a GEN /usr/src/linux-5.0.7-gentoo/tools/objtool/arch/x86/lib/inat-tables.c CC /usr/src/linux-5.0.7-gentoo/tools/objtool/arch/x86/decode.o In file included from arch/x86/../../elf.h:22, from arch/x86/decode.c:26: /usr/include/libelf/gelf.h:25:5: error: "__LIBELF_INTERNAL__" is not defined, evaluates to 0 [-Werror=undef] #if __LIBELF_INTERNAL__ ^~~~~~~~~~~~~~~~~~~ In file included from arch/x86/../../elf.h:22, from arch/x86/decode.c:26: /usr/include/libelf/gelf.h:31:5: error: "__LIBELF_NEED_LINK_H" is not defined, evaluates to 0 [-Werror=undef] #if __LIBELF_NEED_LINK_H ^~~~~~~~~~~~~~~~~~~~ /usr/include/libelf/gelf.h:33:7: error: "__LIBELF_NEED_SYS_LINK_H" is not defined, evaluates to 0 [-Werror=undef] #elif __LIBELF_NEED_SYS_LINK_H ^~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors mv: cannot stat '/usr/src/linux-5.0.7-gentoo/tools/objtool/arch/x86/.decode.o.tmp': No such file or directory Portage 2.3.62 (python 3.6.8-final-0, default/linux/amd64/17.0/musl/hardened, gcc-8.3.0, musl-1.1.21, 5.0.5-gentoo x86_64) ================================================================= System uname: Linux-5.0.5-gentoo-x86_64-Intel-R-_Core-TM-_i5-3320M_CPU_@_2.60GHz-with-gentoo-2.6 KiB Mem: 7967904 total, 4866464 free KiB Swap: 4194300 total, 4193020 free Head commit of repository gentoo: 97578a2fe3d231d1801514aa5f863cfacec0c1ac Head commit of repository anarchy: c3bbb5532939864c7426276174321558e72e2d11 Head commit of repository libressl: 67f586c4a2c75b9d24c077e7b137215658769195 Head commit of repository mozilla: 2eae01e84da5e4949011eaa643b78adb6989db0f Head commit of repository musl: 87abe67d42745f7e5a46699b29220656c9b8b536 Head commit of repository smaeul: 48f69bef7b208e902f0a71cea586c16e882b51ee sh dash 0.5.10.2 ld GNU ld (Gentoo 2.32 p1) 2.32.0 ccache version 3.6 [enabled] app-shells/bash: 5.0_p3-r1::gentoo dev-lang/perl: 5.26.3::anarchy dev-lang/python: 2.7.16::gentoo, 3.6.8::gentoo dev-util/ccache: 3.6::gentoo dev-util/cmake: 3.14.1::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.6-r1::gentoo sys-apps/openrc: 0.41.2::gentoo sys-apps/sandbox: 2.15::musl sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r4::gentoo sys-devel/automake: 1.16.1-r1::gentoo sys-devel/binutils: 2.32::gentoo sys-devel/gcc: 8.3.0::musl sys-devel/gcc-config: 2.0::gentoo sys-devel/libtool: 2.4.6-r5::gentoo sys-devel/make: 4.2.1-r4::gentoo sys-kernel/linux-headers: 5.0-r1::musl (virtual/os-headers) sys-libs/musl: 1.1.21::gentoo Repositories: gentoo location: /usr/portage sync-type: git sync-uri: git+ssh://git@git.gentoo.org/repo/gentoo.git priority: -1000 eclass-overrides: musl anarchy location: /home/sources/anarchy sync-type: git sync-uri: git+ssh://git@git.gentoo.org/dev/anarchy.git masters: gentoo eclass-overrides: musl libressl location: /home/sources/libressl sync-type: git sync-uri: https://anongit.gentoo.org/git/repo/proj/libressl.git masters: gentoo eclass-overrides: musl mozilla location: /home/sources/mozilla sync-type: git sync-uri: git+ssh://git@git.gentoo.org/proj/mozilla.git masters: gentoo eclass-overrides: musl musl location: /home/sources/musl sync-type: git sync-uri: git+ssh://git@git.gentoo.org/proj/musl.git masters: gentoo eclass-overrides: musl smaeul location: /home/sources/smaeul sync-type: git sync-uri: https://github.com/smaeul/portage-overlay masters: gentoo eclass-overrides: musl ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-gentoo-linux-musl" CFLAGS="-Os -march=native -pipe" CHOST="x86_64-gentoo-linux-musl" CONFIG_PROTECT="/etc /usr/lib/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-Os -march=native -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=y --autounmask-keep-masks" ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-Os -march=native -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict strict-keepdir stricter unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-Os -march=native -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common" MAKEOPTS="-j5 --no-print-directory -l4" PKGDIR="/usr/portage/packages" PORTAGE_COMPRESS="xz" PORTAGE_COMPRESS_FLAGS="-z -9 -f -S .xz" 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="X aac alsa amd64 bluetooth bzip2 cairo cdio cgroups crypt cups cxx dbus dri dri3 elogind ffmpeg gtk gtk3 hardened iconv icu introspection ipv6 jpeg libcanberra libressl libsecret libtirpc lzma mp3 ncurses nptl opengl openmp pam pax_kernel pcre pdf pic pie png policykit postproc pulseaudio readline seccomp spell sqlite ssh ssl ssp theora threads tiff truetype udev udisks unicode upower vaapi vpx x264 xattr xcb xinerama xtpax xvid zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="libressl" 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 synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF X86" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="i915 i965 intel" 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: CC, CPPFLAGS, CTARGET, CXX, LANG, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS
This also got backported to 4.19.33. The offending commit is https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/objtool/Makefile?id=056d28d135bca0b1d0908990338e00e9dadaf057 Reverting the CFLAGS line back to the previous iteration works.
(In reply to Moritz Kick from comment #1) > This also got backported to 4.19.33. > > The offending commit is > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/ > tools/objtool/Makefile?id=056d28d135bca0b1d0908990338e00e9dadaf057 > > Reverting the CFLAGS line back to the previous iteration works. Okay this is only breaking on systems with libelf installed. Once I switched the musl setup over to elfutils the kernel builds as it is expected. Will let the kernel team decide how they want to handle it.
make -C /usr/src/linux-5.0.7-gentoo/tools/build CFLAGS= LDFLAGS= fixdep make[1]: Entering directory '/usr/src/linux-5.0.7-gentoo/tools/build' HOSTCC fixdep.o HOSTLD fixdep-in.o LINK fixdep make[1]: Leaving directory '/usr/src/linux-5.0.7-gentoo/tools/build' make -C /usr/src/linux-5.0.7-gentoo/tools/lib/subcmd/ OUTPUT=/usr/src/linux-5.0.7-gentoo/tools/objtool/ make[1]: Entering directory '/usr/src/linux-5.0.7-gentoo/tools/lib/subcmd' make -C /usr/src/linux-5.0.7-gentoo/tools/build CFLAGS= LDFLAGS= /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep HOSTCC /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep.o HOSTLD /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep-in.o LINK /usr/src/linux-5.0.7-gentoo/tools/objtool/fixdep CC /usr/src/linux-5.0.7-gentoo/tools/objtool/exec-cmd.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/help.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/pager.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/parse-options.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/run-command.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/sigchain.o CC /usr/src/linux-5.0.7-gentoo/tools/objtool/subcmd-config.o LD /usr/src/linux-5.0.7-gentoo/tools/objtool/libsubcmd-in.o AR /usr/src/linux-5.0.7-gentoo/tools/objtool/libsubcmd.a make[1]: Leaving directory '/usr/src/linux-5.0.7-gentoo/tools/lib/subcmd' make[1]: Entering directory '/usr/src/linux-5.0.7-gentoo/tools/objtool' make[2]: Entering directory '/usr/src/linux-5.0.7-gentoo/tools/objtool' CC arch/x86/decode.o LD arch/x86/objtool-in.o make[2]: Leaving directory '/usr/src/linux-5.0.7-gentoo/tools/objtool' CC builtin-check.o CC builtin-orc.o CC check.o CC orc_gen.o CC orc_dump.o CC elf.o CC special.o CC objtool.o CC libstring.o CC str_error_r.o LD objtool-in.o make[1]: Leaving directory '/usr/src/linux-5.0.7-gentoo/tools/objtool' LINK objtool
OK no idea about libelf, but for binutils-2.32 you need elfutils-0.175 or later. (I suspect that the fix which went into elfutils-0.175 was never applied to libelf; the result is that kernel compilation fails. Though the errors should look different...)
(In reply to Andreas K. Hüttel from comment #4) > OK no idea about libelf, but for binutils-2.32 you need elfutils-0.175 or > later. > > (I suspect that the fix which went into elfutils-0.175 was never applied to > libelf; the result is that kernel compilation fails. Though the errors > should look different...) This happens with binutils 2.31.1-r4 as well, as stated in my previous comment somehow the CFLAGS get messed up, when it appends -I/usr/inlucde/libelf
I thought this was working fine recently with a custom musl rootfs, albeit as long as elfix was installed on the kernel build host. At the time I was only trying to "prep" the kernel source tree so genkernel could build an initramfs. Basically either elfutils or elfix is required for kernel make prepare which is required for genkernel. IIRC objtool also built fine but I can't swear to that part...
* using kernel versions 5.0.7 and 4.20.17 plus latest genkernel with a couple of patches (see above)
*** This bug has been marked as a duplicate of bug 692688 ***