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

zfs 2.15 fails to build with kernel 5.18.6 #179551

Closed
schwarmco opened this issue Jun 29, 2022 · 8 comments
Closed

zfs 2.15 fails to build with kernel 5.18.6 #179551

schwarmco opened this issue Jun 29, 2022 · 8 comments
Labels
0.kind: build failure A package fails to build 6.topic: kernel The Linux kernel

Comments

@schwarmco
Copy link

Steps To Reproduce

Steps to reproduce the behavior:

  1. Tried to upgrade to NixOS 22.05 (was blocked before by zfs 2.14 not support kernel 5.18; now zfs 2.15 was backported to NixOS 22.05 - see [Backport release-22.05] zfs: 2.1.4 -> 2.1.5 #178830)
  2. Run nixos-rebuild with updated channel

Build log

The failing parts are:

In file included from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/string.h:253,
                 from /build/source/include/os/linux/spl/sys/strings.h:24,
                 from /build/source/module/icp/algs/edonr/edonr.c:32:
In function 'fortify_memcpy_chk',
    inlined from 'EdonRInit' at /build/source/module/icp/algs/edonr/edonr.c:491:3:
/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/fortify-string.h:328:25: error: call to '__write_overflow_field' declared with attribu>
  328 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

cc1: all warnings being treated as errors
make[5]: *** [/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/scripts/Makefile.build:288: /build/source/module/icp/algs/edonr/edonr.o] Error 1

[...]

In file included from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/string.h:253,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/bitmap.h:11,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/cpumask.h:12,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/arch/x86/include/asm/cpumask.h:5,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/arch/x86/include/asm/msr.h:11,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/arch/x86/include/asm/processor.h:22,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/arch/x86/include/asm/timex.h:5,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/timex.h:67,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/time32.h:13,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/time.h:60,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/stat.h:19,
                 from /nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/module.h:13,
                 from /build/source/include/os/linux/spl/sys/atomic.h:27,
                 from /build/source/include/sys/zfs_context.h:46,
                 from /build/source/module/zfs/dsl_bookmark.c:22:
In function 'fortify_memset_chk',
    inlined from 'dsl_bookmark_set_phys' at /build/source/module/zfs/dsl_bookmark.c:384:3:
/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/include/linux/fortify-string.h:242:25: error: call to '__write_overflow_field' declared with attribu>
  242 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

cc1: all warnings being treated as errors
make[5]: *** [/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/scripts/Makefile.build:288: /build/source/module/zfs/dsl_bookmark.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/scripts/Makefile.build:550: /build/source/module/zfs] Error 2
  LD [M]  /build/source/module/zstd/zzstd.o
make[3]: *** [/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/source/Makefile:1838: /build/source/module] Error 2
make[3]: Leaving directory '/nix/store/ihdv194y3fw10zgazid0v3fldhl12vvk-linux-5.18.6-dev/lib/modules/5.18.6/build'
make[2]: *** [Makefile:55: modules-Linux] Error 2
make[2]: Leaving directory '/build/source/module'
make[1]: *** [Makefile:930: all-recursive] Error 1
make[1]: Leaving directory '/build/source'
make: *** [Makefile:791: all] Error 2

Additional context

This may be a zfs problem, not a nix problem, but i am not sure about that. It may even be a "me"-problem, though i have no custom config around zfs- or kernel-versions.

Notify maintainers

@Madouura @hmenke @jcumming @jonringer @wizeman @fpletz @globin

Metadata

[user@@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.17.7, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@schwarmco schwarmco added the 0.kind: build failure A package fails to build label Jun 29, 2022
@hmenke
Copy link
Member

hmenke commented Jun 29, 2022

I can reproduce this, but there is something fishy going on. The ZFS kernel module should be built on Hydra and substituted. Why is this not happening?

@hmenke
Copy link
Member

hmenke commented Jun 29, 2022

Looks like this is fixed in openzfs/zfs#13575. Let's hope that the ZFS team will make a new release soon.

@schwarmco
Copy link
Author

Thank you for finding this issue - i've searched the zfs issue tracker but didn't stumble across this one.

Though, as you also mentioned - i thought, if Hydra is green, i'm good to go?

@mpasternacki
Copy link
Contributor

mpasternacki commented Jun 30, 2022

Commits fixing openzfs/zfs#13575 don't apply cleanly to 2.1.5 release, but I managed to cherry-pick the ones that fix NixOS build. I'm typing this comment from NixOS ZFS root on 5.18 now. Here's the overlay: https://gist.github.com/mpasternacki/819b7ff33c0df3f37b5687cfdeabf954

@veprbl veprbl added the 6.topic: kernel The Linux kernel label Jun 30, 2022
@PedroHLC
Copy link
Member

PedroHLC commented Jul 2, 2022

In case you're in a rush to update, linux-zen seems to not treat all warnings as errors and don't have this issue...

@hmenke
Copy link
Member

hmenke commented Jul 3, 2022

I've opened an issue on ZFS in the hope to speed things up a little bit: openzfs/zfs#13622

@hmenke
Copy link
Member

hmenke commented Jul 4, 2022

This is the configuration I am using for now. An overlay for the userspace tools is not necessary since these build without problems.

{
  boot.kernelPackages = pkgs.linuxPackages_5_18.extend (final: prev: {
    zfs = prev.zfs.overrideAttrs ({ NIX_CFLAGS_COMPILE ? [], ... }: {
      NIX_CFLAGS_COMPILE = NIX_CFLAGS_COMPILE ++ [ "-Wno-error=attribute-warning" ];
    });
  });
}

or if you want to patch your checkout of nixpkgs:

diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index eec2d1ad04a..a56c92044a5 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -109,6 +109,8 @@ let
       # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
       NIX_CFLAGS_LINK = "-lgcc_s";
 
+      NIX_CFLAGS_COMPILE = [ "-Wno-error=attribute-warning" ];
+
       hardeningDisable = [ "fortify" "stackprotector" "pic" ];
 
       configureFlags = [

@PedroHLC
Copy link
Member

PedroHLC commented Jul 5, 2022

Successfully builds with #180275 (which includes a backport to the WERROR skipping from unstable, and is on the way to release-22.05).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build 6.topic: kernel The Linux kernel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants