I can't seem to build bcachefs as a module: root /usr/src/linux # grep BCACHEFS /usr/src/linux-6.12.21-gentoo/.config CONFIG_BCACHEFS_FS=m # CONFIG_BCACHEFS_QUOTA is not set # CONFIG_BCACHEFS_ERASURE_CODING is not set # CONFIG_BCACHEFS_POSIX_ACL is not set # CONFIG_BCACHEFS_DEBUG is not set # CONFIG_BCACHEFS_TESTS is not set # CONFIG_BCACHEFS_LOCK_TIME_STATS is not set # CONFIG_BCACHEFS_NO_LATENCY_ACCT is not set CONFIG_BCACHEFS_SIX_OPTIMISTIC_SPIN=y # CONFIG_BCACHEFS_PATH_TRACEPOINTS is not set root /usr/src/linux # make -j5 modules [..] CC [M] fs/bcachefs/six.o CC [M] fs/bcachefs/snapshot.o CC [M] fs/bcachefs/subvolume.o CC [M] fs/bcachefs/super.o CC [M] fs/bcachefs/super-io.o CC [M] fs/bcachefs/sysfs.o CC [M] fs/bcachefs/tests.o CC [M] fs/bcachefs/time_stats.o CC [M] fs/bcachefs/thread_with_file.o CC [M] fs/bcachefs/trace.o CC [M] fs/bcachefs/two_state_shared_lock.o CC [M] fs/bcachefs/util.o CC [M] fs/bcachefs/varint.o CC [M] fs/bcachefs/xattr.o LD [M] fs/bcachefs/bcachefs.o MODPOST Module.symvers ERROR: modpost: "closure_wait" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "__closure_sync" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "closure_put" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "__closure_wake_up" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "closure_sub" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "__closure_sync_timeout" [fs/bcachefs/bcachefs.ko] undefined! ERROR: modpost: "closure_return_sync" [fs/bcachefs/bcachefs.ko] undefined! make[2]: *** [scripts/Makefile.modpost:145: Module.symvers] Error 1 make[1]: *** [/usr/src/linux-6.12.21-gentoo/Makefile:1898: modpost] Error 2 make: *** [Makefile:224: __sub-make] Error 2 Is this just me or is this a bug in the kernel (+patchset) itself? Can anyone reproduce this? Reproducible: Always Steps to Reproduce: 1. make menuconfig and change CONFIG_BCACHEFS_FS to <m> 2. make -j5 modules 3. get error Actual Results: Errors listed above. Expected Results: Module should compile successfully. emerge --info: Portage 3.0.67 (python 3.12.10-final-0, default/linux/amd64/23.0/split-usr/desktop, gcc-14, glibc-2.40-r8, 6.12.21-gentoo x86_64) ================================================================= System uname: Linux-6.12.21-gentoo-x86_64-Intel-R-_Core-TM-_i7-7600U_CPU_@_2.80GHz-with-glibc2.40 KiB Mem: 16139468 total, 10322216 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Mon, 05 May 2025 20:15:00 +0000 Head commit of repository gentoo: 38b00ab0e149757350a5f80442b07238f4b6303a Head commit of repository audio-overlay: 13e44330d84f919b06bc47c88190cea53d58a46b Head commit of repository throttled: 0e650de3a990f005db565bf02c013c39a6a59437 Head commit of repository tlp: af2991838d36eb8337616cb66dcda93d455fdd66 sh bash 5.2_p37 ld GNU ld (Gentoo 2.43 p3) 2.43.1 app-misc/pax-utils: 1.3.8::gentoo app-shells/bash: 5.2_p37::gentoo dev-build/autoconf: 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo, 1.17-r1::gentoo dev-build/cmake: 3.31.5::gentoo dev-build/libtool: 2.5.4::gentoo dev-build/make: 4.4.1-r100::gentoo dev-build/meson: 1.7.0::gentoo dev-java/java-config: 2.3.4::gentoo dev-lang/perl: 5.40.2::gentoo dev-lang/python: 3.12.10::gentoo, 3.13.3::gentoo dev-lang/rust-bin: 1.82.0-r101::gentoo, 1.84.1-r2::gentoo, 1.85.1::gentoo llvm-core/clang: 18.1.8-r6::gentoo, 19.1.7::gentoo llvm-core/llvm: 18.1.8-r6::gentoo, 19.1.7::gentoo sys-apps/baselayout: 2.17::gentoo sys-apps/openrc: 0.56::gentoo sys-apps/sandbox: 2.39::gentoo sys-devel/binutils: 2.43-r2::gentoo, 2.44::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/gcc: 14.2.1_p20241221::gentoo sys-devel/gcc-config: 2.12.1::gentoo sys-kernel/linux-headers: 6.12::gentoo (virtual/os-headers) sys-libs/glibc: 2.40-r8::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync1.sk.gentoo.org/gentoo-portage priority: -1000 volatile: True sync-rsync-verify-max-age: 3 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 audio-overlay location: /usr/local/overlay/audio-overlay sync-type: git sync-uri: https://github.com/gentoo-audio/audio-overlay.git masters: gentoo volatile: True my-local-overlay location: /usr/local/portage masters: gentoo priority: 0 volatile: True throttled location: /usr/local/overlay/throttled sync-type: git sync-uri: https://github.com/erpalma/throttled-overlay masters: gentoo volatile: True tlp location: /usr/local/overlay/tlp sync-type: git sync-uri: https://github.com/dywisor/tlp-portage.git masters: gentoo volatile: True ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=native -fomit-frame-pointer -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.9/conf /var/bind" 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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -march=native -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--autounmask-write" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME" 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 merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="https://mirror.wheel.sk/gentoo https://mirror.dkm.cz/gentoo/ https://packages.hs-regensburg.de/gentoo-distfiles/ http://gentoo.osuosl.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed" LEX="flex" LINGUAS="en_US de" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" 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" SHELL="/bin/bash" USE="X a52 aac aacs acpi alsa amd64 audiofile avi bash-completion bluetooth bluray branding bzip2 bzlib cairo cdda cddb cdparanoia cdr cet cpdflib crypt cryptsetup cscope ctype cups dbus device-mapper dga dio directfb divx4linux dri dri3 dts dv dvd dvdr dvdread efi elogind encode exif fam fbcon fdftk fdk ffmpeg flac flatfile ftp gcj gd gdbm gif gimpprint glamor gpu-accel gtk gtk3 gtk4 gtkstyle gui iconv icu imagemagick imap imlib introspection jack javafx joystick jpeg ladcca lame lcms libnotify libsamplerate libtirpc mad matroska metric mikmod mime ming mmap mmx mp3 mp4 mpeg mtp multilib ncurses nptl nptlonly ogg oggvorbis openal opengl openmp opus pam pango pcre pda pdf pdflib perl png policykit ppds qml qt5 qt6 quicktime radiotap readline samba sdl seccomp slang smp sndfile sockets sound speex spell split-usr sse sse2 sse4_1 sse4_2 ssl ssse3 startup-notification svg test-rust theora threads tidy tiff truetype udev udisks unicode upower usb userlocales vaapi vcd vim-syntax vorbis vulkan wayland wifi win32codecs wma wmf wxwidgets x264 xattr xcb xft xinerama xml xml2 xmms xosd xv xvid xvmc zlib" ABI_X86="64" ADA_TARGET="gcc_14" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="synaptics evdev" KERNEL="linux" L10N="en-US de" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres17" PYTHON_SINGLE_TARGET="python3_13" PYTHON_TARGETS="python3_13" RUBY_TARGETS="ruby32" SANE_BACKENDS="plustek pixma net" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Works fine for me. I used the following steps: 1. cd /usr/src/linux-6.12.21-gentoo 2. make O=$HOME/linux-build defconfig 3. cd ~/linux-build 4. make menuconfig 5. <enable BCACHEFS> 6. make -j12
(In reply to Mike Gilbert from comment #1) > Works fine for me. I used the following steps: > > 1. cd /usr/src/linux-6.12.21-gentoo > 2. make O=$HOME/linux-build defconfig > 3. cd ~/linux-build > 4. make menuconfig > 5. <enable BCACHEFS> > 6. make -j12 I can't replicate either, can you attach your .config ?
Got *** *** The source tree is not clean, please run 'make mrproper' *** in /usr/src/linux-6.12.21-gentoo *** and ran make mrproper. All working now, thanks a lot. I can reproduce the issue by building the kernel without the module, then enabling it and just running "make modules". I think it's around 20 years now that I'm building my own kernels, and whenever I needed an additional module, this was enough. I thought the Makefile would trigger the necessary dependencies and I am not sure whether this might be a bug. Or maybe I was wrong (and lucky) all the time :-) If I "make" (the static kernel part) before (with bcachefs selected, as a module), and "make modules" afterwards, it works. So if this is expected, this ticket can be closed. If "make modules" should check/build all necessary dependencies, I guess that is a/the bug.