[Libguestfs] [PATCH virt-v2v] v2v: Use LIBGUESTFS_CFLAGS/LIBS when compiling and linking.

Richard W.M. Jones rjones at redhat.com
Wed Mar 11 22:14:24 UTC 2020


On Wed, Mar 11, 2020 at 05:33:50PM +0100, Pino Toscano wrote:
> On Tuesday, 10 March 2020 16:06:20 CET Richard W.M. Jones wrote:
> > Allows virt-v2v to be compiled against the libguestfs build directory.
> 
> This is not just about building against an uninstalled libguestfs,
> rather about building against libguestfs no matter where it is
> installed (so not just in default system paths).

Yeah I think that too.  It's also interesting why it happens to work
now.  It's because the OCaml guestfs module contains an instruction
that tells ocamlopt to add ‘-lguestfs’ to the GCC link command, and
we're using ocamlopt to link the final program.

$ ocamlobjinfo /usr/lib64/ocaml/guestfs/mlguestfs.cmxa  | grep ^Extra
Extra C object files: -lmlguestfs -L../lib/.libs -lguestfs
Extra C options:

And even more interesting is the bogus -L option there, which is plain
wrong and will need another patch to fix (it's unrelated to this fix).

Rich.

> > ---
> >  v2v/Makefile.am | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/v2v/Makefile.am b/v2v/Makefile.am
> > index 2a196d45d..104420d13 100644
> > --- a/v2v/Makefile.am
> > +++ b/v2v/Makefile.am
> > @@ -197,6 +197,7 @@ virt_v2v_CPPFLAGS = \
> >  	-I$(top_srcdir)/lib
> >  virt_v2v_CFLAGS = \
> >  	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
> > +	$(LIBGUESTFS_CFLAGS) \
> >  	$(LIBVIRT_CFLAGS) \
> >  	$(LIBOSINFO_CFLAGS)
> >  
> > @@ -230,6 +231,7 @@ endif
> >  
> >  OCAMLCLIBS = \
> >  	-lqemuopts \
> > +	$(LIBGUESTFS_LIBS) \
> >  	$(LIBVIRT_LIBS) \
> >  	$(LIBXML2_LIBS) \
> >  	$(JANSSON_LIBS) \
> 
> LGTM.
> 
> Thanks,
> -- 
> Pino Toscano



> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list