Bug 249311 - r365715: OpenZFS: buildkernel failure: ld: error: undefined symbol: dataset_kstats_destroy
Summary: r365715: OpenZFS: buildkernel failure: ld: error: undefined symbol: dataset_k...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Allan Jude
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-14 13:29 UTC by O. Hartmann
Modified: 2020-09-17 15:46 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2020-09-14 13:29:01 UTC
Running 12-STABLE (FreeBSD 12.2-STABLE #34 r365625: Fri Sep 11 09:57:09 CEST 2020 amd64) and compiling 12-STABLE sources for revision 365715 with a customozed kernel (which compiled fine with r365625 as could be seen above) fails to buildkernel with the error shown below:


[...]
cc -target x86_64-unknown-freebsd12.2 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe -O3 -DNDEBUG -march=native -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -nostdinc -I/usr/src/sys/contrib -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/amd64.amd64/sys/FREYJA/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -I/usr/obj/usr/src/amd64.amd64/sys/FREYJA -MD -MF.depend.genoffset.o -MTgenoffset.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -mno-aes -mno-avx -std=iso9899:1999 -fcommon  /usr/src/sys/kern/genoffset.c
--- kernel ---
ld: error: undefined symbol: dataset_kstats_destroy
>>> referenced by zfs_vfsops.c
>>>               zfs_vfsops.o:(zfsvfs_free)
>>> referenced by zvol.c
>>>               zvol.o:(zvol_remove_minors_impl)

ld: error: undefined symbol: dataset_kstats_create
>>> referenced by zfs_vfsops.c
>>>               zfs_vfsops.o:(zfsvfs_setup)
>>> referenced by zvol.c
>>>               zvol.o:(zvol_create_minor)

ld: error: undefined symbol: dataset_kstats_update_read_kstats
>>> referenced by zfs_vnops.c
>>>               zfs_vnops.o:(zfs_freebsd_read)
>>> referenced by zvol.c
>>>               zvol.o:(zvol_strategy)

ld: error: undefined symbol: dataset_kstats_update_write_kstats
>>> referenced by zfs_vnops.c
>>>               zfs_vnops.o:(zfs_freebsd_write)
>>> referenced by zvol.c
>>>               zvol.o:(zvol_strategy)
*** [kernel] Error code 1
Comment 1 O. Hartmann 2020-09-14 16:18:50 UTC
Just an add on: GENERIC kernel fails the same way.
Comment 2 Trond.Endrestol 2020-09-15 06:45:30 UTC
I got the same failure on my stable/12 builder at work, two nights in a row. My builder tries to compile world and 10 (custom) kernels, including GENERIC, every night.

Judging by the commit log, r365689 might be the culprit.

I use meta mode and -D NO_CLEAN. If the coming night's attempt to build stable/12 fails in the same manner, I'm tempted to blow away the kernel subdirectories.
Comment 3 Trond.Endrestol 2020-09-15 07:03:45 UTC
(In reply to Trond.Endrestol from comment #2)
Blowing away the kernel subdirectories in the object tree serves no purposes, I discovered on an experimental system also running stable/12. Reverting to r365688 made the kernels build successfully again.
Comment 4 O. Hartmann 2020-09-16 05:40:33 UTC
While we usually statically compile in "options ZFS" into the kernel, I tried commenting out this option. Now, I got rid of the error.

We saw this behaviour on CURRENT recently and there it has been fixed.
Comment 5 Trond.Endrestol 2020-09-16 06:47:16 UTC
(In reply to O. Hartmann from comment #4)
I added allanjude@ to the Cc list as he committed r365689.

Allan, would it be possible to add the necessary Makefile logic to allow options ZFS in stable/12?
Comment 6 commit-hook freebsd_committer 2020-09-16 20:59:13 UTC
A commit references this bug:

Author: allanjude
Date: Wed Sep 16 20:58:24 UTC 2020
New revision: 365808
URL: https://svnweb.freebsd.org/changeset/base/365808

Log:
  Connect new ZFS source file to the kernel build

  This was missed in r365689

  This causes compile issues when building ZFS into the kernel

  PR:		249311
  MFC-with:	r365689
  Sponsored by:	Klara Inc.

Changes:
  stable/12/sys/conf/files
Comment 7 Trond.Endrestol 2020-09-17 14:20:24 UTC
(In reply to commit-hook from comment #6)
Wonderful. Thank you, Allan. I'll do a test later this evening.
Comment 8 Trond.Endrestol 2020-09-17 15:46:29 UTC
(In reply to Trond.Endrestol from comment #7)
I just upgraded an experimental system now running amd64 stable/12 r365834, where options ZFS, device dtrace, and device dtraceall goes in the mix.