Skip to content

Commit

Permalink
kernel 4.14 require libelf to compile modules.
Browse files Browse the repository at this point in the history
[...]
make modules -C /nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/build EXTRA_CFLAGS=-Werror-implicit-function-declaration M=/tmp/nix-build-spl-kernel-2017-11-16-4.14.9.drv-0/source/build
/nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/source/Makefile:939: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.

This patch introduces kernel.moduleBuildDependencies to avoid the logic "stdenv.lib.optional (stdenv.lib.versionAtLeast kernel.version "4.14") libelf" in multiple places.

[dezgeg did some minor tweaks on top]
  • Loading branch information
dguibert authored and dezgeg committed Dec 29, 2017
1 parent 77cc639 commit 1e77d0b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
Expand Up @@ -36,7 +36,7 @@ stdenv.mkDerivation {

NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration";

buildInputs = [ patchelf cdrkit makeWrapper dbus ];
buildInputs = [ patchelf cdrkit makeWrapper dbus ] ++ kernel.moduleBuildDependencies;

installPhase = ''
mkdir -p $out
Expand Down
5 changes: 4 additions & 1 deletion pkgs/os-specific/linux/kernel/manual-config.nix
Expand Up @@ -49,6 +49,9 @@ let
inherit (stdenv.lib)
hasAttr getAttr optional optionalString optionalAttrs maintainers platforms;

# Dependencies that are required to build kernel modules
moduleBuildDependencies = stdenv.lib.optional (stdenv.lib.versionAtLeast version "4.14") libelf;

installkernel = writeTextFile { name = "installkernel"; executable=true; text = ''
#!${stdenv.shell} -e
mkdir -p $4
Expand Down Expand Up @@ -85,7 +88,7 @@ let
(isModular || (config.isDisabled "FIRMWARE_IN_KERNEL"));
in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // {
passthru = {
inherit version modDirVersion config kernelPatches configfile;
inherit version modDirVersion config kernelPatches configfile moduleBuildDependencies;
};

inherit src;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/spl/default.nix
Expand Up @@ -25,7 +25,7 @@ let

patches = [ ./const.patch ./install_prefix.patch ];

nativeBuildInputs = [ autoreconfHook ];
nativeBuildInputs = [ autoreconfHook ] ++ optional (kernel != null) kernel.moduleBuildDependencies;

hardeningDisable = [ "pic" ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/sysdig/default.nix
Expand Up @@ -14,7 +14,7 @@ stdenv.mkDerivation rec {

buildInputs = [
cmake zlib luajit ncurses perl jsoncpp libb64 openssl curl jq gcc
];
] ++ optional (kernel != null) kernel.moduleBuildDependencies;

hardeningDisable = [ "pic" ];

Expand Down
2 changes: 2 additions & 0 deletions pkgs/os-specific/linux/tp_smapi/default.nix
Expand Up @@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
name = "tp-smapi-${version}";
};

nativeBuildInputs = kernel.moduleBuildDependencies;

hardeningDisable = [ "pic" ];

makeFlags = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/os-specific/linux/virtualbox/default.nix
Expand Up @@ -7,6 +7,8 @@ stdenv.mkDerivation {
"fortify" "pic" "stackprotector"
];

nativeBuildInputs = kernel.moduleBuildDependencies;

patches = [
./fix_kerndir.patch
./fix_kbuild.patch
Expand Down
3 changes: 2 additions & 1 deletion pkgs/os-specific/linux/zfs/default.nix
Expand Up @@ -38,7 +38,8 @@ let

patches = extraPatches;

nativeBuildInputs = [ autoreconfHook nukeReferences ];
nativeBuildInputs = [ autoreconfHook nukeReferences ]
++ optional (kernel != null) kernel.moduleBuildDependencies;
buildInputs =
optionals buildKernel [ spl ]
++ optionals buildUser [ zlib libuuid python attr ]
Expand Down

0 comments on commit 1e77d0b

Please sign in to comment.