[PATCH] fix gratuitous dependencies in ZFS libraries / utilities

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Oct 29 21:31:44 UTC 2011


On Fri, Oct 28, 2011 at 10:08:24PM +0200, Robert Millan wrote:
> 
> Hi,
> 
> Some of the ZFS libraries and utilities are linked with libraries they
> don't use:
> 
>  - zinject doesn't use libavl
>  - ztest doesn't use libz
>  - zdb uses neither libavl nor libz
>  - zfs uses neither libbsdxml nor libm, nor libsbuf
>  - zpool uses neither libbsdxml nor libm, nor libsbuf
> 
> In addition, libzfs needs libm because it uses pow(), however it isn't
> linked with -lm.  This went unnoticed because all its users had -lm before.
> 
> Attached patch (tested with "make buildworld") fixes these problems.

Sounds good.

> Index: cddl/usr.bin/zinject/Makefile
> ===================================================================
> --- cddl/usr.bin/zinject/Makefile	(revision 226869)
> +++ cddl/usr.bin/zinject/Makefile	(working copy)
> @@ -19,8 +19,8 @@
>  CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
>  CFLAGS+= -I${.CURDIR}/../../lib/libumem
>  
> -DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
> +DPADD=	${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
>  	${LIBZFS} ${LIBZPOOL}
> -LDADD=	-lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
> +LDADD=	-lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
>  
>  .include <bsd.prog.mk>
> Index: cddl/usr.bin/ztest/Makefile
> ===================================================================
> --- cddl/usr.bin/ztest/Makefile	(revision 226869)
> +++ cddl/usr.bin/ztest/Makefile	(working copy)
> @@ -18,8 +18,8 @@
>  CFLAGS+= -I${.CURDIR}/../../lib/libumem
>  
>  DPADD=	${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
> -	${LIBPTHREAD} ${LIBZ} ${LIBAVL}
> -LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
> +	${LIBPTHREAD} ${LIBAVL}
> +LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lavl
>  
>  CSTD=	c99
>  
> Index: cddl/usr.sbin/zdb/Makefile
> ===================================================================
> --- cddl/usr.sbin/zdb/Makefile	(revision 226869)
> +++ cddl/usr.sbin/zdb/Makefile	(working copy)
> @@ -23,9 +23,9 @@
>  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
>  CFLAGS+= -I${.CURDIR}/../../lib/libumem
>  
> -DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
> -	${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
> -LDADD=	-lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
> +DPADD=	${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
> +	${LIBUUTIL} ${LIBZFS} ${LIBZPOOL}
> +LDADD=	-lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool
>  
>  
>  .include <bsd.prog.mk>
> Index: cddl/lib/libzfs/Makefile
> ===================================================================
> --- cddl/lib/libzfs/Makefile	(revision 226869)
> +++ cddl/lib/libzfs/Makefile	(working copy)
> @@ -6,8 +6,8 @@
>  .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
>  
>  LIB=	zfs
> -DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
> -LDADD=	-lmd -lpthread -lumem -lutil
> +DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM}
> +LDADD=	-lmd -lpthread -lumem -lutil -lm
>  
>  SRCS=	deviceid.c \
>  	fsshare.c \
> Index: cddl/sbin/zfs/Makefile
> ===================================================================
> --- cddl/sbin/zfs/Makefile	(revision 226869)
> +++ cddl/sbin/zfs/Makefile	(working copy)
> @@ -21,8 +21,8 @@
>  CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
>  CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
>  
> -DPADD=	${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
> +DPADD=	${LIBGEOM} ${LIBNVPAIR} ${LIBUMEM} \
>  	${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
> -LDADD=	-lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
> +LDADD=	-lgeom -lnvpair -lumem -lutil -luutil -lzfs
>  
>  .include <bsd.prog.mk>
> Index: cddl/sbin/zpool/Makefile
> ===================================================================
> --- cddl/sbin/zpool/Makefile	(revision 226869)
> +++ cddl/sbin/zpool/Makefile	(working copy)
> @@ -26,8 +26,8 @@
>  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
>  CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
>  
> -DPADD=	${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
> +DPADD=	${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
>  	${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
> -LDADD=	-lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
> +LDADD=	-lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs
>  
>  .include <bsd.prog.mk>

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20111029/fa1eeb62/attachment.pgp


More information about the freebsd-fs mailing list