Notes: Building the daemon on Windows
by Richard W.M. Jones
My aim is to get to the stage where we can start the daemon and run it
under Wine. By using a dummy QEMU wrapper[1] we can have the daemon
be run from a real Linux libguestfs program. It'll be running on the
same machine (not in an appliance) and it'll be running under Wine,
not Windows, but that's good enough to start testing the XDR protocol
and some simple commands.
It's very close to being able to do that now - there are only a few
minor fixes left.
If you want to try this, you will need the latest libguestfs sources
from git, plus the three attached patches which hack out bits that
I've not fixed yet.
You'll need the basic Fedora MinGW cross-compiler packages installed,
and the Fedora package "wine(x86-32)".
You'll need to build and install PortableXDR:
http://git.annexia.org/?p=fedora-mingw.git;a=tree;f=portablexdr;hb=HEAD
Configure the toplevel of libguestfs source as if you were going
to build it for Fedora.
The go into the daemon subdirectory and reconfigure it for
cross-compilation:
cd daemon
make distclean
mingw32-configure
make
That will get you 99% of the way there. There are still some bits to
hack out and/or fix in order to get a daemon.
Rich.
[1] http://libguestfs.org/guestfs.3.html#qemu_wrappers
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
14 years, 10 months
Building guestfs_protocol.o in the daemon
by Richard W.M. Jones
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
14 years, 10 months