Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libelf required by some module compilation (on kernel >= 4.14.9) #33166

Closed
wants to merge 1 commit into from

Conversation

dguibert
Copy link
Member

Motivation for this change

Kernel 4.14 require libelf to compile modules.
[...]
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.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@vcunat
Copy link
Member

vcunat commented Dec 29, 2017

Cross-link: #33049 (only 4.14.9 has been affected so far).

@dezgeg
Copy link
Contributor

dezgeg commented Dec 29, 2017

Can we not duplicate this stdenv.lib.optional (stdenv.lib.versionAtLeast kernel.version "4.14") libelf logic in multiple places? Instead, have the kernel package set passthru.moduleBuildDependencies (or something) and use that in the module packages.

@dezgeg dezgeg mentioned this pull request Dec 29, 2017
8 tasks
@@ -25,7 +26,8 @@ let

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

nativeBuildInputs = [ autoreconfHook ];
nativeBuildInputs = [ autoreconfHook ]
++ optional (stdenv.lib.versionAtLeast kernel.version "4.14") libelf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. this would become just

nativeBuildInputs = [ autoreconfHook ] ++ kernel.moduleBuildDependencies;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, it could be cleaner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dguibert Are you working on this? I'd like to fix this asap and would do it myself otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'll update this branch very soon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

[...]
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
Copy link
Contributor

dezgeg commented Dec 29, 2017

Looks nice, thanks. Pushed in 1e77d0b with some minor tweaks.

@dezgeg dezgeg closed this Dec 29, 2017
@fpletz
Copy link
Member

fpletz commented Dec 29, 2017

Thanks!

vcunat added a commit that referenced this pull request Dec 29, 2017
fpletz added a commit that referenced this pull request Dec 29, 2017
fpletz added a commit that referenced this pull request Dec 29, 2017
In this expression the boolean flags `buildUser` and `buildKernel` determine
if either userspace tools or the kernel module is being built.

cc #33166
fpletz pushed a commit that referenced this pull request Dec 30, 2017
fpletz added a commit that referenced this pull request Dec 30, 2017
(cherry picked from commit 1fb0d3d)
fpletz added a commit that referenced this pull request Dec 30, 2017
In this expression the boolean flags `buildUser` and `buildKernel` determine
if either userspace tools or the kernel module is being built.

cc #33166

(cherry picked from commit 6b74d2c)
@pbogdan pbogdan mentioned this pull request Dec 30, 2017
8 tasks
@orivej orivej changed the title libelf required by some module compilation (on kernel >= 4.14) libelf required by some module compilation (on kernel >= 4.14.9) Dec 31, 2017
@dguibert dguibert deleted the fix/modules-require-libelf branch July 25, 2018 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants