[libvirt] [PATCH 0/2] Fix 'make' issues on OpenBSD.

Pushing both under the build-breaker rule. 'make check' still fails some gnulib tests on OpenBSD, but that's not quite as severe. Eric Blake (2): build: avoid warnings from gcc 4.2.1 build: don't fail when xsltproc is missing docs/Makefile.am | 9 +++++---- m4/virt-compile-warnings.m4 | 8 +++++++- src/internal.h | 6 ++++-- 3 files changed, 16 insertions(+), 7 deletions(-) -- 1.7.11.4

OpenBSD ships with gcc 4.2.1, which annoyingly treats all format strings as though they were also attribute((nonnull)). The two concepts are orthogonal, though, as evidenced by the number of spurious warnings it generates on uses where we know that virReportError specifically handles NULL instead of a format string; worse, since we now force -Werror on git builds, it prevents development builds on OpenBSD. I hate to do this, as it disables ALL format checking on older gcc, and therefore misses out on some useful checks (code that happened to compile on Linux may still have type mismatches when compiled on other platforms, as evidenced by the number of times I have fixed formatting mismatches for uid_t as found by warnings on Cygwin), but I don't see any other way to keep -Werror alive and still compile on OpenBSD. A more invasive change would be to make virReportError() mark its format attribute as nonnull, and fix (a lot of) fallout; we may end up doing that anyways as part of danpb's error refactoring improvements, but not today. * src/internal.h (ATTRIBUTE_FMT_PRINTF): Use preferred spellings. * m4/virt-compile-warnings.m4 (-Wformat): Disable on older gcc. --- m4/virt-compile-warnings.m4 | 8 +++++++- src/internal.h | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index 26f6134..c3ff962 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -110,8 +110,14 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ gl_WARN_ADD([-Wjump-misses-init]) # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral, - # so we need to manually re-exclude it. + # so we need to manually re-exclude it. Also, older gcc 4.2 + # added an implied ATTRIBUTE_NONNULL on any parameter marked + # ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our + # intentional use of virReportError(code, NULL). gl_WARN_ADD([-Wno-format-nonliteral]) + if test $lv_cv_gcc_pragma_push_works = no; then + gl_WARN_ADD([-Wno-format]) + fi # This should be < 256 really. Currently we're down to 4096, # but using 1024 bytes sized buffers (mostly for virStrerror) diff --git a/src/internal.h b/src/internal.h index 832a931..02fdb8d 100644 --- a/src/internal.h +++ b/src/internal.h @@ -151,9 +151,11 @@ */ # ifndef ATTRIBUTE_FMT_PRINTF # if __GNUC_PREREQ (4, 4) -# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (gnu_printf, fmtpos,argpos))) +# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) \ + __attribute__((__format__ (__gnu_printf__, fmtpos, argpos))) # else -# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (printf, fmtpos,argpos))) +# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) \ + __attribute__((__format__ (__printf__, fmtpos, argpos))) # endif # endif -- 1.7.11.4

On a machine without xsltproc, the build failed with: Scripting search.php /usr/local/bin/bash: line 1: search.php.tmp: No such file or directory rm: ./search.php: No such file or directory Regression introduced in commit 28183590. * docs/Makefile.am (%.php): Skip in the same conditions when the .tmp file is skipped. --- docs/Makefile.am | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index fad8979..91c3d33 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -186,10 +186,11 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in || { rm $@ && exit 1; }; fi %.php: %.php.tmp %.php.code.in - @echo "Scripting $@"; \ - sed -e '/<a id="php_placeholder"><\/a>/r '"$(srcdir)/$@.code.in" \ - -e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \ - || { rm $(srcdir)/$@ && exit 1; } + @if [ -x $(XSLTPROC) ] ; then \ + echo "Scripting $@"; \ + sed -e '/<a id="php_placeholder"><\/a>/r '"$(srcdir)/$@.code.in" \ + -e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \ + || { rm $(srcdir)/$@ && exit 1; }; fi html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ -- 1.7.11.4

I tested both OpenBSD and cygwin; both failed 'make check' with: GEN check-symfile Can't return outside a subroutine at ./check-symfile.pl line 13. Perl requires 'exit 77' instead of 'return 77' in that context, but even with that tweak, the build still fails, since the exit code of 77 is only special to explicit TESTS=foo listings, and not to make-only dependency rules where we are not going through automake's test framework. * src/check-symfile.pl: Kill bogus platform check... * src/Makefile.am (check-symfile): ...and replace with an automake conditional. --- Another push under the build-breaker rule. src/Makefile.am | 6 +++++- src/check-symfile.pl | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 39adeac..9f27fcf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -312,10 +312,14 @@ PDWTAGS = \ fi # .libs/libvirt.so is built by libtool as a side-effect of the Makefile -# rule for libvirt.la +# rule for libvirt.la. However, checking symbols relies on Linux ELF layout +if WITH_LINUX check-symfile: libvirt.syms libvirt.la $(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt.syms \ .libs/libvirt.so +else +check-symfile: +endif PROTOCOL_STRUCTS = \ $(srcdir)/remote_protocol-structs \ diff --git a/src/check-symfile.pl b/src/check-symfile.pl index 5454f45..454fed3 100755 --- a/src/check-symfile.pl +++ b/src/check-symfile.pl @@ -8,11 +8,6 @@ my @elflibs = @ARGV; my @wantsyms; my %gotsyms; -# Skip on non-linux -if ($^O ne "linux") { - return 77; # Automake's skip code -} - open SYMFILE, $symfile or die "cannot read $symfile: $!"; while (<SYMFILE>) { -- 1.7.11.4

On 09/05/2012 12:02 PM, Eric Blake wrote:
Pushing both under the build-breaker rule. 'make check' still fails some gnulib tests on OpenBSD, but that's not quite as severe.
Shoot; I was thinking too much about Jasper's patches. I was actually testing on FreeBSD, not OpenBSD, for these particular patches (and for the commits I've already pushed, oh well). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On systems without cyrus-sasl-devel available (I happened to be in that situation on my FreeBSD testing), this test fails rather miserably: TEST: libvirtdconftest .....!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!! 39 FAIL FAIL: libvirtdconftest with verbose output showing things like: 39) Test corruption ... libvir: Config File error : unsupporeted configuration: remoteReadConfigFile: /usr/home/dummy/libvirt/tests/../daemon/libvirtd.conf: auth_tcp: unsupported auth sasl * tests/libvirtdconftest.c (testCorrupt): Avoid failure when sasl is missing. --- Another build-breaker push. tests/libvirtdconftest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c index b394d54..a6e1f35 100644 --- a/tests/libvirtdconftest.c +++ b/tests/libvirtdconftest.c @@ -120,6 +120,13 @@ testCorrupt(const void *opaque) goto cleanup; } +#if !HAVE_SASL + if (strstr(err->message, "unsupported auth sasl")) { + VIR_DEBUG("sasl unsupported, skipping this config"); + goto cleanup; + } +#endif + switch (type) { case VIR_CONF_LONG: if (!strstr(err->message, "invalid type: got string; expected long")) { -- 1.7.11.4
participants (1)
-
Eric Blake