[Libguestfs] Further nbdkit patches for Haiku

Richard W.M. Jones rjones at redhat.com
Tue Nov 6 09:02:17 UTC 2018

François, thanks for the patches so far.

This morning I pushed:

  build: add missing #include "byte-swapping.h"

  build: more fallbacks for mkostemp

The iconv patch makes iconv a requirement.  I don't know how many
systems actually lack iconv -- probably not very many -- but even so I
don't want nbdkit to require a library just to compile a single
plugin, as a feature of nbdkit is that the minimal set of
requirements.  So I have modified your patch (see attachment) to make
the iconv dependency optional.  Can you let me know if this works on
Haiku or if I broke anything?

The final patch was:

  build: avoid hardcoding /var/tmp by default, use P_tmpdir

Unfortunately this won't work well on some Linux systems which use the
/tmp-on-tmpdir misfeature.  On these systems, /tmp has only a small,
limited amount of space and is backed by memory, and we must use
/var/tmp for large files.  I don't know how to fix this.  Perhaps a

  [haiku*], [LARGE_TMPDIR=/tmp]
                   [Temporary directory for large files])

would be enough for now?

Finally about the list of failing tests:


Mostly these are because of the old qemu-io binary.  The qemu-io -f
option was added 4 years ago :-/ so it could be time to upgrade.

This error:

  ./test-shebang-perl.sh: PID file was not created
  rect ELF header
  FAIL test-shebang-perl.sh (exit status: 1)

(I think the error message is "incorrect ELF header") could be
something to do with the way we use shebangs (#!).  IIRC this also
fails on FreeBSD so probably nbdkit is doing something which is not
correct POSIX.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
-------------- next part --------------
>From b5f66b866b3365f62236668638c093be426c89a3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Tue, 6 Nov 2018 08:46:27 +0000
Subject: [PATCH] build: add a simple test for iconv
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It's used by one plugin.

There is a proper iconv.m4 available but it makes autoconf fail
if we don't bring in more of gettext, which wants to add 50 files around.

Original Author: François Revol <revol at free.fr>

RWMJ: I modified this to make the iconv dependency optional.
If unavailable, the floppy plugin is disabled.
 README                     |  5 +++++
 configure.ac               | 24 ++++++++++++++++++++++++
 plugins/floppy/Makefile.am |  7 ++++++-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/README b/README
index e0c95cd..0b266f2 100644
--- a/README
+++ b/README
@@ -77,6 +77,11 @@ For the iso plugin:
  - genisoimage or mkisofs
+For the floppy plugin:
+ - iconv (on Linux this is built into glibc, on other systems
+   it may be a separate library)
 For the libvirt plugin:
  - libvirt
diff --git a/configure.ac b/configure.ac
index a64ae31..11a3fd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,6 +144,7 @@ AC_CHECK_HEADERS([\
 	alloca.h \
 	byteswap.h \
 	endian.h \
+	iconv.h \
 	selinux/selinux.h \
 	sys/endian.h \
 	sys/prctl.h \
@@ -164,6 +165,29 @@ AC_SEARCH_LIBS([dlopen], [dl dld], [
+AC_SEARCH_LIBS([iconv], [iconv], [
+        AS_IF([test "x$ac_cv_search_iconv" != "xnone required"],
+	    [ICONV_LIBS="$ac_cv_search_iconv"
+             have_iconv=yes
+            ],
+            [ICONV_LIBS=
+             have_iconv=yes])
+	], [
+        AC_SEARCH_LIBS([libiconv], [iconv], [
+                AS_IF([test "x$ac_cv_search_libiconv" != "xnone required"],
+                [ICONV_LIBS="$ac_cv_search_libiconv"
+                 have_iconv=yes
+                ],
+                [ICONV_LIBS=
+                 have_iconv=yes])
+            ], [AC_MSG_WARN([unable to find a library containing iconv])
+        ])
+AM_CONDITIONAL([HAVE_ICONV],[test "x$have_iconv" = "xyes"])
 dnl Check if -rdynamic linker flag works.
 LDFLAGS="${LDFLAGS} -rdynamic"
diff --git a/plugins/floppy/Makefile.am b/plugins/floppy/Makefile.am
index b6c2435..9723478 100644
--- a/plugins/floppy/Makefile.am
+++ b/plugins/floppy/Makefile.am
@@ -34,6 +34,8 @@ include $(top_srcdir)/common-rules.mk
 EXTRA_DIST = nbdkit-floppy-plugin.pod
 plugin_LTLIBRARIES = nbdkit-floppy-plugin.la
 nbdkit_floppy_plugin_la_SOURCES = \
@@ -51,7 +53,8 @@ nbdkit_floppy_plugin_la_CPPFLAGS = \
 nbdkit_floppy_plugin_la_CFLAGS = \
 nbdkit_floppy_plugin_la_LDFLAGS = \
-	-module -avoid-version -shared
+	-module -avoid-version -shared \
 nbdkit_floppy_plugin_la_LIBADD = \
@@ -66,3 +69,5 @@ nbdkit-floppy-plugin.1: nbdkit-floppy-plugin.pod
 endif HAVE_POD

More information about the Libguestfs mailing list