Some fixes for building the Debian package for 1.20.2
I needed to add a few patches to be able to build libguestfs 1.20.2 out of tree. Mostly srcdir/builddir issues -- I think that I had posted something for building the daemon before. As mentioned on IRC, I found that compiling (Ruby bindings) caused config.h file shipped with the Ruby headers to be included rather than ${builddir}/config.h. This can be fixed because the relevant checks can be performed in the extconf.rb script as well. Cheers, -Hilko
CC guestfsd-9p.o In file included from ../../../daemon/9p.c:32:0: ../../../daemon/daemon.h:33:34: fatal error: guestfs-internal-all.h: No such file or directory --- daemon/Makefile.am | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index a57b7f3..99259a6 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -19,8 +19,6 @@ include $(top_srcdir)/subdir-rules.mk CLEANFILES = stamp-guestfsd.pod -libsrcdir = $(top_builddir)/src - generator_built = \ actions.h \ stubs.c \ @@ -42,7 +40,7 @@ EXTRA_DIST = \ $(BUILT_SOURCES) \ guestfsd.pod -$(shared_with_library): %: $(libsrcdir)/% +$(shared_with_library): %: $(top_srcdir)/src/% rm -f $@ ln $< $@ @@ -53,10 +51,10 @@ noinst_LIBRARIES = libprotocol.a libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing -$(libsrcdir)/guestfs_protocol.c: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.c -$(libsrcdir)/guestfs_protocol.h: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.h +$(top_builddir)/src/guestfs_protocol.c: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.c +$(top_builddir)/src/guestfs_protocol.h: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.h # Build the errnostring perfect hash code. The generated code has lots # of warnings so we must compile it in a separate mini-library. @@ -197,6 +195,7 @@ guestfsd_LDADD = \ guestfsd_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/src \ -I$(top_builddir)/src guestfsd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -- 1.7.10.4
On Mon, Feb 18, 2013 at 10:43:40PM +0100, Hilko Bengen wrote:
CC guestfsd-9p.o In file included from ../../../daemon/9p.c:32:0: ../../../daemon/daemon.h:33:34: fatal error: guestfs-internal-all.h: No such file or directory --- daemon/Makefile.am | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index a57b7f3..99259a6 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -19,8 +19,6 @@ include $(top_srcdir)/subdir-rules.mk
CLEANFILES = stamp-guestfsd.pod
-libsrcdir = $(top_builddir)/src - generator_built = \ actions.h \ stubs.c \ @@ -42,7 +40,7 @@ EXTRA_DIST = \ $(BUILT_SOURCES) \ guestfsd.pod
-$(shared_with_library): %: $(libsrcdir)/% +$(shared_with_library): %: $(top_srcdir)/src/% rm -f $@ ln $< $@
@@ -53,10 +51,10 @@ noinst_LIBRARIES = libprotocol.a libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
-$(libsrcdir)/guestfs_protocol.c: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.c -$(libsrcdir)/guestfs_protocol.h: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.h +$(top_builddir)/src/guestfs_protocol.c: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.c +$(top_builddir)/src/guestfs_protocol.h: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.h
# Build the errnostring perfect hash code. The generated code has lots # of warnings so we must compile it in a separate mini-library. @@ -197,6 +195,7 @@ guestfsd_LDADD = \ guestfsd_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/src \ -I$(top_builddir)/src guestfsd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -- 1.7.10.4
ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
(Not entirely sure whether using Gnulib to replace standard functions is a good idea at all.) link with libgnu: CCLD libguestfs-test-tool libguestfs_test_tool-test-tool.o: In function `main': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:103: undefined reference to `rpl_getopt_long' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:113: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:125: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:126: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:109: undefined reference to `rpl_optarg' libguestfs_test_tool-test-tool.o: In function `set_qemu': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:382: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:366: undefined reference to `rpl_perror' libguestfs_test_tool-test-tool.o: In function `make_files': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:416: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:428: undefined reference to `rpl_perror' --- test-tool/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index 200f2cb..bb2e03c 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -37,7 +37,8 @@ libguestfs_test_tool_CFLAGS = \ $(GPROF_CFLAGS) $(GCOV_CFLAGS) libguestfs_test_tool_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/gnulib/lib/libgnu.la libguestfs-test-tool.1 $(top_builddir)/html/libguestfs-test-tool.1.html: stamp-libguestfs-test-tool.pod -- 1.7.10.4
On Mon, Feb 18, 2013 at 10:43:41PM +0100, Hilko Bengen wrote:
(Not entirely sure whether using Gnulib to replace standard functions is a good idea at all.)
link with libgnu: CCLD libguestfs-test-tool libguestfs_test_tool-test-tool.o: In function `main': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:103: undefined reference to `rpl_getopt_long' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:113: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:125: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:126: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:109: undefined reference to `rpl_optarg' libguestfs_test_tool-test-tool.o: In function `set_qemu': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:382: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:366: undefined reference to `rpl_perror' libguestfs_test_tool-test-tool.o: In function `make_files': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:416: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:428: undefined reference to `rpl_perror' --- test-tool/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index 200f2cb..bb2e03c 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -37,7 +37,8 @@ libguestfs_test_tool_CFLAGS = \ $(GPROF_CFLAGS) $(GCOV_CFLAGS)
libguestfs_test_tool_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/gnulib/lib/libgnu.la
libguestfs-test-tool.1 $(top_builddir)/html/libguestfs-test-tool.1.html: stamp-libguestfs-test-tool.pod
-- 1.7.10.4
Weird ... but ... ACK. I wonder why we don't see this error on Fedora? In any case I can't see any problem with linking libguestfs-test-tool to gnulib. In fact I don't know why we weren't doing that already. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Otherwise, _guestfs.c can't be compiled due to many strict-prototype warnings turned into errors: compiling /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/../.. /ruby/ext/guestfs/_guestfs.c In file included from /usr/include/ruby-1.9.1/ruby.h:32:0, from /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-d efault/../../ruby/ext/guestfs/_guestfs.c:29: /usr/include/ruby-1.9.1/ruby/ruby.h:1093:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes] [...] --- ruby/Makefile.am | 1 - ruby/ext/guestfs/extconf.rb.in | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 5b755e5..2ecb6a8 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -29,7 +29,6 @@ EXTRA_DIST = \ Rakefile.in \ README.rdoc \ doc/site/index.html \ - ext/guestfs/extconf.rb \ lib/guestfs.rb \ run-bindtests \ run-ruby-tests \ diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in index e358551..c638a85 100644 --- a/ruby/ext/guestfs/extconf.rb.in +++ b/ruby/ext/guestfs/extconf.rb.in @@ -31,7 +31,7 @@ end $CFLAGS = "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " << - "@WARN_CFLAGS@ @WERROR_CFLAGS@" + "@WARN_CFLAGS@" create_header -create_makefile(extension_name) +create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4
On Mon, Feb 18, 2013 at 10:43:42PM +0100, Hilko Bengen wrote:
Otherwise, _guestfs.c can't be compiled due to many strict-prototype warnings turned into errors:
compiling /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/../.. /ruby/ext/guestfs/_guestfs.c In file included from /usr/include/ruby-1.9.1/ruby.h:32:0, from /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-d efault/../../ruby/ext/guestfs/_guestfs.c:29: /usr/include/ruby-1.9.1/ruby/ruby.h:1093:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
I think it's probably better to compile without --enable-gcc-warnings. In the Fedora package we don't use that option. I only use it on my local machine. Unless this error still happens even without that option?
[...]
This hunk seems separate (for separate src/build dir?), and looks OK to me:
create_header -create_makefile(extension_name) +create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4
RIch. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
On Mon, Feb 18, 2013 at 10:43:42PM +0100, Hilko Bengen wrote:
Otherwise, _guestfs.c can't be compiled due to many strict-prototype warnings turned into errors:
compiling /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/../.. /ruby/ext/guestfs/_guestfs.c In file included from /usr/include/ruby-1.9.1/ruby.h:32:0, from /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-d efault/../../ruby/ext/guestfs/_guestfs.c:29: /usr/include/ruby-1.9.1/ruby/ruby.h:1093:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes] [...]
I can reproduce this error too on Wheezy. It seems to be a bug in Ruby (1.9.1). It doesn't occur in 1.9.3 that we have in Fedora. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
--- configure.ac | 8 -------- generator/ruby.ml | 5 +++-- ruby/ext/guestfs/extconf.rb.in | 4 ++++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 5129f4f..4c06d32 100644 --- a/configure.ac +++ b/configure.ac @@ -1143,14 +1143,6 @@ AS_IF([test "x$enable_ruby" != "xno"],[ AC_MSG_RESULT([-l$libruby]) AC_CHECK_LIB([$libruby],[ruby_init], [have_libruby=1],[have_libruby=]) - - dnl Symbols that we substitute when missing. - AS_IF([test -n "$have_libruby"],[ - old_LIBS="$LIBS" - LIBS="$LIBS -l$libruby" - AC_CHECK_FUNCS([rb_hash_lookup]) - LIBS="$old_LIBS" - ]) ],[ AC_MSG_RESULT([not found]) ]) diff --git a/generator/ruby.ml b/generator/ruby.ml index 4f2c60b..2b15d8c 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -35,8 +35,6 @@ let rec generate_ruby_c () = generate_header CStyle LGPLv2plus; pr "\ -#include <config.h> - #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -693,6 +691,9 @@ Init__guestfs (void) e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError); #ifdef HAVE_RB_DEFINE_ALLOC_FUNC +#ifndef HAVE_TYPE_RB_ALLOC_FUNC_T +#define rb_alloc_func_t void* +#endif rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_create); #endif diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in index c638a85..afd76ba 100644 --- a/ruby/ext/guestfs/extconf.rb.in +++ b/ruby/ext/guestfs/extconf.rb.in @@ -33,5 +33,9 @@ $CFLAGS = "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " << "@WARN_CFLAGS@" +have_func("rb_hash_lookup") +have_func("rb_define_alloc_func") +have_type("rb_alloc_func_t") + create_header create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4
On Mon, Feb 18, 2013 at 10:43:43PM +0100, Hilko Bengen wrote:
--- configure.ac | 8 -------- generator/ruby.ml | 5 +++-- ruby/ext/guestfs/extconf.rb.in | 4 ++++ 3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac index 5129f4f..4c06d32 100644 --- a/configure.ac +++ b/configure.ac @@ -1143,14 +1143,6 @@ AS_IF([test "x$enable_ruby" != "xno"],[ AC_MSG_RESULT([-l$libruby]) AC_CHECK_LIB([$libruby],[ruby_init], [have_libruby=1],[have_libruby=]) - - dnl Symbols that we substitute when missing. - AS_IF([test -n "$have_libruby"],[ - old_LIBS="$LIBS" - LIBS="$LIBS -l$libruby" - AC_CHECK_FUNCS([rb_hash_lookup]) - LIBS="$old_LIBS" - ]) ],[ AC_MSG_RESULT([not found]) ]) diff --git a/generator/ruby.ml b/generator/ruby.ml index 4f2c60b..2b15d8c 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -35,8 +35,6 @@ let rec generate_ruby_c () = generate_header CStyle LGPLv2plus;
pr "\ -#include <config.h> - #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -693,6 +691,9 @@ Init__guestfs (void) e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError);
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +#ifndef HAVE_TYPE_RB_ALLOC_FUNC_T +#define rb_alloc_func_t void* +#endif rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_create); #endif
diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in index c638a85..afd76ba 100644 --- a/ruby/ext/guestfs/extconf.rb.in +++ b/ruby/ext/guestfs/extconf.rb.in @@ -33,5 +33,9 @@ $CFLAGS = "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " << "@WARN_CFLAGS@"
+have_func("rb_hash_lookup") +have_func("rb_define_alloc_func") +have_type("rb_alloc_func_t") + create_header create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4
This one (without the effects of the previous patch) looks fine to me, so ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
FYI when I tried this patch, I got the following compile error. However possibly I didn't 'make clean' before compiling ... _guestfs.c: In function 'rb_hash_lookup': _guestfs.c:76:30: error: 'struct RHash' has no member named 'tbl' _guestfs.c:76:19: error: passing argument 3 of 'st_lookup' discards 'volatile' qualifier from pointer target type [-Werror] In file included from /usr/include/ruby/intern.h:34:0, from /usr/include/ruby/ruby.h:1382, from /usr/include/ruby.h:32, from _guestfs.c:31: /usr/include/ruby/st.h:114:5: note: expected 'st_data_t *' but argument is of type 'volatile VALUE *' cc1: all warnings being treated as errors Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
participants (2)
-
Hilko Bengen -
Richard W.M. Jones