Bug 260094

Summary: git 9e9c651caceb is too ZFS specific
Product: Base System Reporter: clbuisson
Component: miscAssignee: Mark Johnston <markj>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: bz, emaste, grahamperrin
Priority: ---    
Version: CURRENT   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
proposed pach to build without zfs none

Description clbuisson 2021-11-28 14:57:33 UTC

    
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2021-11-28 15:01:55 UTC
Let's flesh this out. 

> 9e9c651caceb

<https://cgit.freebsd.org/src/commit/?id=9e9c651caceb9ecd17131e8bb29791ba4cf1cec7>

> cddl: fix missing ZFS library dependencies
> 
> In 9fae47666 zfsd got a libspl dependency to avoid undefined references.
> However that workaround did not help external consumers of libzfs_core.
> 
> Fix all missing dependencies lld 13 and the rtld complain about.

<https://cgit.freebsd.org/src/commit/?id=9fae47666>
Comment 2 clbuisson 2021-11-28 15:08:07 UTC
Created attachment 229765 [details]
proposed pach to build without zfs
Comment 3 clbuisson 2021-11-28 15:13:24 UTC
Compiling head with

#WITHOUT_CDDL=
WITHOUT_ZFS=

buildworld is stopped by

building shared library libnvpair.so.2
..
ld: error: relocation R_X86_64_PC32 cannot be used against symbol __stderrp; rec
ompile with -fPIC
>>> defined in /home/obj/home/src/amd64.amd64/tmp/lib/libc.so.7
>>> referenced by assert.c
>>>               assert.o:(libspl_assertf) in archive /home/obj/home/src/amd64.
amd64/tmp/usr/lib/libspl.a
...

but succeed with

#WITHOUT_ZFS=

I traced the problem to git 9e9c651caceb "cddl: fix missing ZFS library dependencies" (2021/11/15)

builworld succeeds after applying the attached patch
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-11-28 15:19:43 UTC
Looking at your patch however I wonder if these libraries are really not needed for anything else and if they are not then someone should probably indeed hide them behind more #ifdef.
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2021-11-29 14:16:38 UTC
I believe this is already fixed by the commit referenced in comment 5.  Please re-open if that does not appear to be the case.

Indeed some of the cddl libraries are, I believe, used only when ZFS is enabled.  That is, dtrace does not make use of libavl, for instance.  I *think* we could disable at least libavl, libnvpair and libuutil when MK_ZFS="no", but I don't have any immediate plan to fix that.