Created attachment 799619 [details] Build log I've encountered an issue when trying to reemerge zfs-kmod with an 5.18.17 kernel configured to be built with llvm. The kernel does boot and zfs does appear to be working correctly. However when I emerge @module-rebuild zfs-kmod fails. The first issue it gives is that the kernel doesn't appear to support loadable modules. CONFIG_MODULES=y is set and running make modules_prepare' gets rid of that issue. Running emerge again will cause it to fail with the unknown type name wait_queue_t. emerge --info
My apologies, I hit enter when I shouldn't have. Here is emerge --info: Portage 3.0.30 (python 3.10.5-final-0, default/linux/amd64/17.1, gcc-11.3.0, glibc-2.35-r8, 5.18.17-gentoo-x86_64 x86_64) ================================================================= System uname: Linux-5.18.17-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i5-8250U_CPU_@_1.60GHz-with-glibc2.35 KiB Mem: 40979448 total, 38744516 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Fri, 12 Aug 2022 22:00:01 +0000 Head commit of repository gentoo: 93909f13c69d2d2b39b5fc4b15f1295cfe60630e sh bash 5.1_p16-r1 ld GNU ld (Gentoo 2.38 p4) 2.38 app-misc/pax-utils: 1.3.4::gentoo app-shells/bash: 5.1_p16-r1::gentoo dev-lang/perl: 5.34.1-r3::gentoo dev-lang/python: 3.10.5::gentoo dev-lang/rust: 1.62.1::gentoo dev-util/cmake: 3.22.4::gentoo dev-util/meson: 0.62.2::gentoo sys-apps/baselayout: 2.8::gentoo sys-apps/openrc: 0.44.10::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.13-r2::gentoo, 2.71-r1::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.38-r2::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 14.0.6-r1::gentoo sys-devel/gcc: 11.3.0::gentoo sys-devel/gcc-config: 2.5-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 14.0.6::gentoo sys-devel/llvm: 14.0.6-r2::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.15-r3::gentoo (virtual/os-headers) sys-libs/glibc: 2.35-r8::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 sync-rsync-verify-max-age: 24 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* @EULA" AR="llvm-ar" CBUILD="x86_64-pc-linux-gnu" CC="clang" CFLAGS="-march=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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" CXX="clang++" CXXFLAGS="-stdlib=libc++ -march=native -O2 -pipe" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH 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="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="C.UTF8" LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind" LINGUAS="en en_US" MAKEOPTS="-j4" NM="llvm-nm" PKGDIR="/var/cache/binpkgs" 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" RANLIB="llvm-ranlib" SHELL="/bin/bash" USE="X acl acpi alsa amd64 bzip2 caps clang cli crypt cups dbus dri elogind equalizer filecaps fortran gdbm gui iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl opengl openmp pam pcre pulseaudio-libfuzzer python qemu readline seccomp sound split-usr ssl threads unicode usb xattr xft xinerama zlib" ABI_X86="64" ADA_TARGET="gnat_2020" 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="vmx vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml ept_mode_based_exec" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
> warning: the compiler differs from the one used to build the kernel > The kernel was built by: gcc (Gentoo 11.3.0 p4) 11.3.0 > You are using: x86_64-pc-linux-gnu-gcc (Gentoo 11.3.0 p4) 11.3.0 And > checking for x86_64-pc-linux-gnu-gcc... clang Looks like you're building zfs-kmod with x86_64-pc-linux-gnu-gcc, which is actually clang, and the kernel was built with gcc?
The kernel is being built with clang as well. I am able to build the kernel with gcc and zfs-kmod with clang without any issue cropping up actually. The config file I used between gcc and clang kernels is the same.
Weird that the log shows differently then. I'm guessing you're forcing clang in a way that the warning doesn't detect then, symlinks maybe? configure detects that: > checking whether wait_queue_entry_t exists... no meaning that lines 50,51 in include/os/linux/spl/sys/wait.h are processed. On my (GCC-using) system, wait_queue_entry_t is detected, and it can be found in /usr/src/linux/include/linux/wait.h on line 14. Your kernel version is 5.18.17-gentoo-x86_64, but your linux-headers version is only 5.15-r3, the latest stable version. Does the problem persist if you install =sys-kernel/linux-headers-5.18-r1?
Created attachment 801061 [details] First zfs-kmod build log This is the initial build log received after which I ran 'make modules_prepare' in the source tree.
Emily, Thank you for your suggestion. I did update the linux headers but I still receive the same error. I believe the issue I'm seeing is due to zfs not picking up that 'CONFIG_MODUELS=Y' has been set. This was the initial error I received and which I probably should have first reported when creating the ticket. Running the command 'make modules_prepare' in the source tree then gives the 'wait_queue_t' error. I attached the initial build log to the ticket. Roger
The solution to the issue was to prepend LLVM=1 LLVM_IAS=1 to the 'genkernel --zfs all' command or the 'emerge zfs' command. These options were enabled in genkernel.conf as per the instructions for compiling the linux kernel with LLVM. It's possible these options aren't being passed correctly when genkernel goes to build the out of tree modules.
Setting KERNEL_LLVM=1 during configuration is the high level trigger in the build scripts to select clang over gcc. I patched the ebuild in my local overlay, but without care for gcc logic $ diff -Naur /var/db/repos/gentoo/sys-fs/zfs-kmod/zfs-kmod-2.1.9.ebuild zfs-kmod-2.1.9.ebuild --- /var/db/repos/gentoo/sys-fs/zfs-kmod/zfs-kmod-2.1.9.ebuild 2023-02-23 19:10:24.000000000 -0500 +++ zfs-kmod-2.1.9.ebuild 2023-03-06 18:30:58.788217846 -0500 @@ -147,6 +147,7 @@ local myconf=( HOSTCC="$(tc-getBUILD_CC)" + KERNEL_LLVM=1 --bindir="${EPREFIX}/bin" --sbindir="${EPREFIX}/sbin" --with-config=kernel