[Libguestfs] Building guestfs_protocol.o in the daemon

Richard W.M. Jones rjones at redhat.com
Wed Nov 25 17:22:02 UTC 2009


Recently we changed the daemon so it builds guestfs_protocol.o
by this rule:

  $(libsrcdir)/guestfs_protocol.o: force
    $(MAKE) -C $(libsrcdir) guestfs_protocol.o
  guestfsd_LDADD = \
    $(libsrcdir)/guestfs_protocol.o \
    #...

The problem with doing this when building on Windows is that the
toplevel src/ directory will be configured differently from the
daemon/ directory.  This means that the above rule compiles
guestfs_protocol.o as a Linux object file, which obviously can't be
linked to the Win32 daemon.  [The exact error is attached at the end]

We only configure the daemon/ directory for cross-compiling, partly
because the daemon is supposed to be a separate entity, mainly because
it'd be a huge amount of work to make the toplevel configure.ac into
something which is Win32-friendly.

I'm not sure what a good way to solve this is though.  My thoughts:

(a) Copy guestfs_protocol.[ch] into the daemon and treat it
totally separately.

(b) Revert the change so we're building again with a rule like:

  guestfsd_SOURCES =
    ../src/guestfs_protocol.c \
    ../src/guestfs_protocol.h \
    #...

I think the change was made originally to support parallel makes, so I
don't know if doing this will break parallel makes again.

(c) Something else ...?  Is there a way to tell automake to put the
object file into the local directory so that we can use the rule above
but not have it break parallel make?

I think I prefer plan (a) ...

Rich.

make[2]: Entering directory `/home/rjones/d/libguestfs-mingw/daemon'
  CC     guestfsd-guestfsd.o
  CC     guestfsd-sync.o
make -C ./../src guestfs_protocol.o
make[3]: Entering directory `/home/rjones/d/libguestfs-mingw/src'
make -C ../src stamp-generator
make[4]: Entering directory `/home/rjones/d/libguestfs-mingw/src'
make[4]: `stamp-generator' is up to date.
make[4]: Leaving directory `/home/rjones/d/libguestfs-mingw/src'
  CC     guestfs_protocol.o
make[3]: Leaving directory `/home/rjones/d/libguestfs-mingw/src'
  CCLD   guestfsd.exe
./../src/guestfs_protocol.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [guestfsd.exe] Error 1
make[2]: Leaving directory `/home/rjones/d/libguestfs-mingw/daemon'

-- 
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://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html




More information about the Libguestfs mailing list