Add a --disable-zfs configure flag.
I happen to have the ZFS libraries installed on my machine, but I don't want my boot loader to use them. It seems to be broken for me at the moment in any case.
I'm new to bazaar and this is my first submission to this mailing list, so please let me know if I've done something incorrectly.
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email protected] # target_branch: http://bzr.savannah.gnu.org/r/grub/trunk/grub/
# testament_sha1: 174b6ca637f4fda2819cb82c07bb55424dee8f5a # timestamp: 2012-02-04 14:48:49 -0500
# base_revision_id: [email protected] #
# Begin patch
=== modified file 'configure.ac'
configure.ac +14 -9
@@ -968,16 +968,21 @@ [Define to 1 if you have the LZMA library.])],) AC_SUBST([LIBLZMA]) -AC_CHECK_LIB([zfs], [libzfs_init], - [LIBZFS="-lzfs" - AC_DEFINE([HAVE_LIBZFS], [1], - [Define to 1 if you have the ZFS library.])],) +AC_ARG_ENABLE([zfs], + [AS_HELP_STRING([--disable-zfs], [Disable ZFS support.])]) + +if test x"$enable_zfs" != xno; then + AC_CHECK_LIB([zfs], [libzfs_init], + [LIBZFS="-lzfs" + AC_DEFINE([HAVE_LIBZFS], [1], + [Define to 1 if you have the ZFS library.])],) + + AC_CHECK_LIB([nvpair], [nvlist_print], + [LIBNVPAIR="-lnvpair" + AC_DEFINE([HAVE_LIBNVPAIR], [1], + [Define to 1 if you have the NVPAIR library.])],) +fi AC_SUBST([LIBZFS]) - -AC_CHECK_LIB([nvpair], [nvlist_print], - [LIBNVPAIR="-lnvpair" - AC_DEFINE([HAVE_LIBNVPAIR], [1], - [Define to 1 if you have the NVPAIR library.])],) AC_SUBST([LIBNVPAIR]) LIBS=""
# Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWdTBFGYAAab/gAAcAQB0Z/// f+/dGr/v//BQBB7stwO3Zu2NdLbhKIp6mTTRogybITT1M0hpkGmgxNDIbSNAlII0yaNTZJ6po9JP SMmjTQAGhkAAPUGSDRRminkgDanpAaBoAANAGgyHNMjIZMENGEwRpo0Y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ciYPQtrwlSgTpOD1JTq86iJU3FnNmwLnMnkHBKZR6WmKJLGZSonFtE1tyTYg0qgI0JrKQ pMaKGmtrWhyIl9BcCaBMJHXhObJngIpwKHK6UcExJLwpHjWxb1N3ClKSNycExaXTheNIIjwUETKe B4BRVQFZBxOG4WE1nashSngy5halgKsjStkFC6JIiOH0grjLEnO1bsP+LuSKcKEhqYIozA==
Quoted 6 lines · Mike Gilbert
I happen to have the ZFS libraries installed on my machine, but I don't want my boot loader to use them. It seems to be broken for me at the moment in any case.
I'm new to bazaar and this is my first submission to this mailing list, so please let me know if I've done something incorrectly.
It's not maintainable to disable a feature every time we meet an issue with a part of code. Could you please detail on your issues?
Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 9 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 6 lines · Mike Gilbert
I happen to have the ZFS libraries installed on my machine, but I don't want my boot loader to use them. It seems to be broken for me at the moment in any case.
I'm new to bazaar and this is my first submission to this mailing list, so please let me know if I've done something incorrectly.
It's not maintainable to disable a feature every time we meet an issue with a part of code.
There is no maintenance burden here, just a one-time change to configure.ac. The code already has the proper #ifdefs and whatnot.
Also, this goes beyond my own build issues. Having configure auto-detect libraries with no way to manually override it creates an "automagic dependency", which we hate over at Gentoo Linux. The following link has a great explanation.
http://www.gentoo.org/proj/en/qa/automagic.xml
Quoted 1 line
Could you please detail on your issues?
I'm getting the following build failure:
gcc -DHAVE_CONFIG_H -I. -Wall -W -I./include -DGRUB_UTIL=1
-DGRUB_LIBDIR=\"/usr/local/lib/grub\" -DLOCALEDIR=\"/usr/local/share/locale\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -DGRUB_TARGET_CPU_I386=1 -DGRUB_FILE=\"util/getroot.c\" -I. -I. -I. -I. -I./include -I./include
-I./grub-core/gnulib -I./grub-core/gnulib -Wno-undef
-Wno-sign-compare -Wno-unused -Wno-unused-parameter -MTutil/libgrubkern_a-getroot.o -MD -MP -MF util/.deps-util/libgrubkern_a-getroot.Tpo -c -o util/libgrubkern_a-getroot.o test -f 'util/getroot.c' || echo './'util/getroot.cutil/getroot.c:2384:1: error: unknown type name 'libzfs_handle_t' util/getroot.c: In function 'fini_libzfs':util/getroot.c:2389:3: warning: implicit declaration of function 'libzfs_fini' [-Wimplicit-function-declaration] util/getroot.c: At top level:util/getroot.c:2392:1: error: unknown type name 'libzfs_handle_t' util/getroot.c: In function 'grub_get_libzfs_handle':util/getroot.c:2397:7: warning: implicit declaration of function 'libzfs_init' [-Wimplicit-function-declaration] util/getroot.c:2397:23: warning: assignment makes pointer from integer without a cast [enabled by default]
I have the libzfs headers in /usr/include/libzfs, which is where the ZFS on Linux build system puts them. My best guess is that it isn't finding libzfs.h, but I haven't really dug in.
Additionally in the case of libzfs specifically:
A) There have been compatibility breakages in the past and it's not versioned.
B) GRUB has an alternate method of working with ZFS (using the command-line tools).
I support* the patch if modified to name the option --disable-libzfs instead of --disable-zfs.
* Mike, to be clear, I'm not a GRUB developer. I have been doing stuff with GRUB and ZFS, which is what brought me to this list.
Signature · 1 line
Richard
Quoted 9 lines · Richard Laager
Additionally in the case of libzfs specifically:
A) There have been compatibility breakages in the past and it's not versioned.
B) GRUB has an alternate method of working with ZFS (using the command-line tools).I support* the patch if modified to name the option --disable-libzfs instead of --disable-zfs.
In that case, --without-libzfs sounds better to me than --disable-libzfs.
Quoted 4 lines · Mike Gilbert
I have the libzfs headers in
/usr/include/libzfs, which is where the ZFS on Linux build system puts them. My best guess is that it isn't findinglibzfs.h, but I haven't really dug in.
As it turns out, there are a few things going on here:
1. grub's configure is failing to detect libnvpair due to some breakage upstream. See https://github.com/zfsonlinux/zfs/issues/560 .
2. getroot.c only includes libzfs.h if HAVE_LIBZFS and HAVE_LIBNVPAIR are defined.
3. getroot.c references libzfs_handle_t if HAVE_LIBZFS is set, but does not look at HAVE_LIBNVPAIR.
So, getroot.c is trying to use a ZFS structure without including the ZFS header(s).
Here's a new bundle including a --without-libzfs flag, and a fix for my build issue.
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email protected] # target_branch: http://bzr.savannah.gnu.org/r/grub/trunk/grub/
# testament_sha1: 3de5f3713591cd87700717bed9a9371d99f3e053 # timestamp: 2012-02-04 20:08:34 -0500
# base_revision_id: [email protected] #
# Begin patch
=== modified file 'configure.ac'
configure.ac +14 -9
@@ -974,16 +974,21 @@ [Define to 1 if you have the LZMA library.])],) AC_SUBST([LIBLZMA]) -AC_CHECK_LIB([zfs], [libzfs_init], - [LIBZFS="-lzfs" - AC_DEFINE([HAVE_LIBZFS], [1], - [Define to 1 if you have the ZFS library.])],) +AC_ARG_WITH([libzfs], + [AS_HELP_STRING([--without-libzfs], [Do not use libzfs.])]) + +if test x"$with_libzfs" != xno; then + AC_CHECK_LIB([zfs], [libzfs_init], + [LIBZFS="-lzfs" + AC_DEFINE([HAVE_LIBZFS], [1], + [Define to 1 if you have the ZFS library.])],) + + AC_CHECK_LIB([nvpair], [nvlist_print], + [LIBNVPAIR="-lnvpair" + AC_DEFINE([HAVE_LIBNVPAIR], [1], + [Define to 1 if you have the NVPAIR library.])],) +fi AC_SUBST([LIBZFS]) - -AC_CHECK_LIB([nvpair], [nvlist_print], - [LIBNVPAIR="-lnvpair" - AC_DEFINE([HAVE_LIBNVPAIR], [1], - [Define to 1 if you have the NVPAIR library.])],) AC_SUBST([LIBNVPAIR]) LIBS=""
=== modified file 'util/getroot.c'
getroot.c +1 -1
@@ -2380,7 +2380,7 @@ }#endif -#ifdef HAVE_LIBZFS +#if defined(HAVE_LIBZFS ) && defined(HAVE_LIBNVPAIR )static libzfs_handle_t *__libzfs_handle; static void
# Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZtMHVMABbj/gAAcAQB9Z/// f+/dmr////BgCbz6e7nVKeDVb2tpxTtSL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Ped9nmj5i 9Hjg7SU3lYx+aR1+6RXae03EoxMT5ZOl841o9pm74fAvJcDOCCSg6+qv2bg0AwGAFKeWtLwCMfwn hDmeC/Wm7yT0R3Q9CkcYlHuLkV6gyixUjIuDRge+ipQ3Wx7TKsv61a2/j1HMzdKNckOcLodBWPmj 8ZIYw8YXnebxxh2GcwMB1JlTHALdJaZoviVRZJS2Bb4MMxdUkSqJRN/Vttu5zx1SQ8XfDp6sTQi6 +JpD7p7y5GmSGAzSQxuiV+iSFQ8IfSvJq1zortc3L4J2nRDl6p3FiiXjsjzrSXJfDa618kOd5dfJ DVDjDrhqOUKR9OCNaO3VdbYm6oWvicE12qHViRtPM3jNJDQ6em6GfsqX3l8MCqK5lDJRiLypMdZz LzXr51KqVVVqLswWMT0qVUqlVDFL6PtmMTZvR0Xbeo6NrwNq++bcxhrox9BR2wsWnQakXnCGWe8p oLtJq1jNNUkNMSiVW6ZrE1wyNDwRgb2dHEzWZbEUzvs7UeF2z4I+E3txPcYBYwOaO9HpOSPuuc50 Ka0qLMidaHVDkfbCkeiPKSGLKdPZHcel7xt5U9tX1am0yhij/4u5IpwoSE2mDqmA
Quoted 4 lines · Mike Gilbert
1. grub's configure is failing to detect libnvpair due to some breakage upstream. See https://github.com/zfsonlinux/zfs/issues/560 .
Please try the attached patch, which should fix this build failure on Gentoo. Remember to run ./autogen.sh after applying the patch.
The same patch is posted to your Github ticket.
Signature · 1 line
Darik Horn <[email protected]>
From 3483b67dae85ac1f039613866c56b51f634faeb7 Mon Sep 17 00:00:00 2001
From: Darik Horn <[email protected]>
Date: Sat, 4 Feb 2012 20:54:43 -0600
Subject: [PATCH] Let libnvpair be linked independently of libzfs.
Autoconf will fail to detect the ZoL libnvpair on systems that do not implicitly link library runtime dependencies, which is anything that has the GCC 4.5 DCO update.
Build libuutil before libnvpair, and put it on the the LDADD line of the libnvpair automake template.
--- lib/Makefile.am | 2 +- lib/libnvpair/Makefile.am | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-)
lib/Makefile.am +1 -1
@@ -4,4 +4,4 @@ SUBDIRS = libspl libavl libefi libshare libunicode # These four libraries, which are installed as the final build product, # incorporate the five convenience libraries given above. -SUBDIRS += libnvpair libuutil libzpool libzfs +SUBDIRS += libuutil libnvpair libzpool libzfs
lib/libnvpair/Makefile.am +3 -0
@@ -14,6 +14,9 @@ libnvpair_la_SOURCES = \ $(top_srcdir)/module/nvpair/nvpair_alloc_fixed.c \ $(top_srcdir)/module/nvpair/nvpair.c +libnvpair_la_LIBADD = \ + $(top_builddir)/lib/libuutil/libuutil.la + libnvpair_la_LDFLAGS = -version-info 1:1:0 EXTRA_DIST = \
Signature · 1 line
1.7.5.4
Quoted 11 lines · Darik Horn
Quoted 4 lines · Mike Gilbert
1. grub's configure is failing to detect libnvpair due to some breakage upstream. See https://github.com/zfsonlinux/zfs/issues/560 .
Please try the attached patch, which should fix this build failure on Gentoo. Remember to run ./autogen.sh after applying the patch.
The same patch is posted to your Github ticket.
Thanks, that fixes AC_CHECK_LIB(nvpair, nvlist_print).