Skip to content

Instantly share code, notes, and snippets.

@nh2
Created April 20, 2019 15:45
Show Gist options
  • Save nh2/117ce6ea015e09762e1e4650734fe688 to your computer and use it in GitHub Desktop.
Save nh2/117ce6ea015e09762e1e4650734fe688 to your computer and use it in GitHub Desktop.
Error compiling kernel on NixOS as shown on https://nixos.wiki/wiki/Linux_Kernel#make_menuconfig
[root@builder:~/kernel]# mkdir tmpdir
[root@builder:~/kernel]# cd tmpdir
[root@builder:~/kernel/tmpdir]# NIX_PATH=nixpkgs=$HOME/kernel/nixpkgs nix-shell -E 'with import <nixpkgs> {}; linux.overrideAttrs (o: {nativeBuildInputs=o.nativeBuildInputs ++ [ pkgconfig ncurses ];})'
[nix-shell:~/kernel/tmpdir]# unpackPhase
unpacking source archive /nix/store/z7wzk01hjfgdcbnbzpkq040v7k9hw427-linux-4.19.36.tar.xz
source root is linux-4.19.36
setting SOURCE_DATE_EPOCH to timestamp 1555744565 of file linux-4.19.36/virt/lib/irqbypass.c
[nix-shell:~/kernel/tmpdir]# cd linux-*
[nix-shell:~/kernel/tmpdir/linux-4.19.36]# cp ../../chromebook-kernel-config .config
[nix-shell:~/kernel/tmpdir/linux-4.19.36]# yes "" | make oldconfig > /dev/null
.config:852:warning: symbol value 'm' invalid for NF_NAT_REDIRECT
.config:955:warning: symbol value 'm' invalid for NF_NAT_MASQUERADE_IPV4
.config:987:warning: symbol value 'm' invalid for NF_NAT_MASQUERADE_IPV6
[nix-shell:~/kernel/tmpdir/linux-4.19.36]# make
SYSTBL arch/x86/include/generated/asm/syscalls_32.h
SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/include/generated/asm/syscalls_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
UPD include/config/kernel.release
WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/x86/include/generated/uapi/asm/poll.h
WRAP arch/x86/include/generated/asm/dma-contiguous.h
WRAP arch/x86/include/generated/asm/early_ioremap.h
WRAP arch/x86/include/generated/asm/export.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
UPD include/generated/uapi/linux/version.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
UPD include/generated/bounds.h
UPD include/generated/timeconst.h
CC arch/x86/kernel/asm-offsets.s
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
DESCEND objtool
In file included from <stdin>:1:0:
/nix/store/0qf90669fmmm1d79fl96msb8rgfz67vb-libelf-0.8.13/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 /root/kernel/tmpdir/linux-4.19.36/tools/objtool/fixdep.o
HOSTLD /root/kernel/tmpdir/linux-4.19.36/tools/objtool/fixdep-in.o
LINK /root/kernel/tmpdir/linux-4.19.36/tools/objtool/fixdep
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/exec-cmd.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/help.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/pager.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/parse-options.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/run-command.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/sigchain.o
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/subcmd-config.o
LD /root/kernel/tmpdir/linux-4.19.36/tools/objtool/libsubcmd-in.o
AR /root/kernel/tmpdir/linux-4.19.36/tools/objtool/libsubcmd.a
GEN /root/kernel/tmpdir/linux-4.19.36/tools/objtool/arch/x86/lib/inat-tables.c
CC /root/kernel/tmpdir/linux-4.19.36/tools/objtool/arch/x86/decode.o
In file included from arch/x86/../../elf.h:22:0,
from arch/x86/decode.c:26:
/nix/store/0qf90669fmmm1d79fl96msb8rgfz67vb-libelf-0.8.13/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:0,
from arch/x86/decode.c:26:
/nix/store/0qf90669fmmm1d79fl96msb8rgfz67vb-libelf-0.8.13/include/libelf/gelf.h:31:5: error: "__LIBELF_NEED_LINK_H" is not defined, evaluates to 0 [-Werror=undef]
#if __LIBELF_NEED_LINK_H
^~~~~~~~~~~~~~~~~~~~
/nix/store/0qf90669fmmm1d79fl96msb8rgfz67vb-libelf-0.8.13/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 '/root/kernel/tmpdir/linux-4.19.36/tools/objtool/arch/x86/.decode.o.tmp': No such file or directory
make[4]: *** [/root/kernel/tmpdir/linux-4.19.36/tools/build/Makefile.build:97: /root/kernel/tmpdir/linux-4.19.36/tools/objtool/arch/x86/decode.o] Error 1
make[3]: *** [/root/kernel/tmpdir/linux-4.19.36/tools/build/Makefile.build:139: arch/x86] Error 2
make[2]: *** [Makefile:49: /root/kernel/tmpdir/linux-4.19.36/tools/objtool/objtool-in.o] Error 2
make[1]: *** [Makefile:63: objtool] Error 2
make: *** [Makefile:1652: tools/objtool] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment