From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y94JX-0002OQ-6v for qemu-devel@nongnu.org; Wed, 07 Jan 2015 23:03:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y94JT-0007ub-UH for qemu-devel@nongnu.org; Wed, 07 Jan 2015 23:03:15 -0500 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:57968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y94JT-0007uG-HO for qemu-devel@nongnu.org; Wed, 07 Jan 2015 23:03:11 -0500 Received: by mail-pd0-f174.google.com with SMTP id fp1so8704048pdb.5 for ; Wed, 07 Jan 2015 20:03:10 -0800 (PST) Received: from HalseyPC ([103.242.168.62]) by mx.google.com with ESMTPSA id e2sm3102186pdo.11.2015.01.07.20.03.07 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 20:03:09 -0800 (PST) From: "Halsey Pian" References: In-Reply-To: Date: Thu, 8 Jan 2015 12:02:37 +0800 Message-ID: <000c01d02af7$f2b94060$d82bc120$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000D_01D02B3B.00DC8060" Content-Language: zh-cn Subject: Re: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multipart message in MIME format. ------=_NextPart_000_000D_01D02B3B.00DC8060 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Hi All, =20 During building this so library, I found that there are many functions = with same name in stubs and other source file, for example, =20 There are two implement functions with same name slirp_pollfds_fill in = slirp.c and main-loop.c. =20 ./stubs/slirp.c:void slirp_pollfds_fill(GArray *pollfds, uint32_t = *timeout) ./main-loop.c: slirp_pollfds_fill(gpollfds, &timeout); =20 Do you know when qemustub should be used? libqemustub.a is only used for = qemu-img, qemu-nbd, qemu-io, but not for qemu-system-x86_64(and other platform binary)?=20 =20 Thanks! =20 Best Regards Halsey Pian =20 From: Halsey Pian [mailto:halsey.pian@gmail.com]=20 Sent: 2015=C4=EA1=D4=C27=C8=D5 16:37 To: qemu-devel@nongnu.org Subject: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library =20 Dear All, =20 Recently, I would try to compile qemu to a so in order to call qemu = internal functions in my program, I=A1=AFm trying to do this by steps, =20 1. Add rules in qemu-2.1.2/ rules.mak =20 %.so: $(call quiet-command,rm -f $@ && $(LINKPROG) $(QEMU_INCLUDES) = $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC -shared -DBUILD_DSO $(CFLAGS) $($@-cflags) $(LDFLAGS) $(LIBS) -o $@ $^," GEN $(TARGET_DIR)$@") =20 2. Add target in qemu-2.1.2/Makefile =20 qemu-kvm-obj =3D vl.o blockdev.o migration.o migration-unix.o qtest.o = migration-fd.o ioport.o savevm.o cpus.o qemu-kvm-obj +=3D net/net.o net/queue.o qemu-kvm-obj +=3D ui/console.o qemu-kvm-obj +=3D qom/object.o qemu-kvm-obj +=3D hw/usb/bus.o qemu-kvm-obj +=3D pixman/pixman/pixman-bits-image.o = pixman/pixman/pixman-utils.o qemu-kvm-obj +=3D qapi/qapi-visit-core.o =20 libqemu.so : $(block-obj-y) $(util-obj-y) qemu-img.o vmstate.o = qemu-file.o $(qemu-kvm-obj) vl.o qapi-event.o migration.o blockdev. o migration-unix.o qtest.o migration-fd.o =20 as you know, the main entrance for final binary qemu-system-x86_64 is = located in vl.c, I just want it and qemu-img.o to be included in the so library, so it seems that there are many dependent objects = above should have to be included, that would be suffering problem to be fixed below during doing this, =20 There are many platform dependent source code i.e. cpus.c memory.c, how = to compile them into so for specific platform? Is there some guidance for building qemu to so? could you give help on this?=20 =20 Thanks a lot! =20 Best Regards Halsey Pian =20 ------=_NextPart_000_000D_01D02B3B.00DC8060 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Hi All,

 

During building this so = library, I found that there are many functions with same name in stubs = and other source file, for example,

 

There are two implement = functions with same name slirp_pollfds_fill in slirp.c and = main-loop.c.

 

./stubs/slirp.c:void = slirp_pollfds_fill(GArray *pollfds, uint32_t = *timeout)

./main-loop.c:    = slirp_pollfds_fill(gpollfds, &timeout);

 

Do you know when qemustub = should be used? libqemustub.a is only used for qemu-img, qemu-nbd, = qemu-io, but not for qemu-system-x86_64(and other platform binary)? =

 

Thanks!

 

Best = Regards

Halsey = Pian

 

From:= = Halsey Pian [mailto:halsey.pian@gmail.com]
Sent: = 2015
=C4=EA1=D4=C27=C8=D5 = 16:37
To: qemu-devel@nongnu.org
Subject: = [Qemu-devel] [Makefile] Compiling Qemu to dynamic = library

 

Dear All,

 

Recently, I would try to = compile qemu to a so in order to call qemu internal functions in my = program, I=A1=AFm trying to do this by steps,

 

1.       = Add rules = in qemu-2.1.2/ rules.mak

 

%.so:

$(call quiet-command,rm -f $@ && = $(LINKPROG) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC = -shared -DBUILD_DSO  $(CFLAGS) $($@-cflags) $(LDFLAGS) = $(LIBS)   -o $@ $^,"  GEN    = $(TARGET_DIR)$@")

 

2.       = Add target = in qemu-2.1.2/Makefile

 

qemu-kvm-obj = =3D vl.o blockdev.o migration.o migration-unix.o qtest.o migration-fd.o = ioport.o savevm.o cpus.o

qemu-kvm-obj = +=3D  net/net.o net/queue.o

qemu-kvm-obj = +=3D ui/console.o

qemu-kvm-obj = +=3D qom/object.o

qemu-kvm-obj = +=3D hw/usb/bus.o

qemu-kvm-obj = +=3D pixman/pixman/pixman-bits-image.o = pixman/pixman/pixman-utils.o

qemu-kvm-obj = +=3D qapi/qapi-visit-core.o

 

libqemu.so : = $(block-obj-y) $(util-obj-y) qemu-img.o  vmstate.o qemu-file.o = $(qemu-kvm-obj) vl.o qapi-event.o migration.o  blockdev.o = migration-unix.o qtest.o migration-fd.o

 

as you know, the = main entrance for final binary qemu-system-x86_64 is located in vl.c, I = just want it and qemu-img.o to be included in the so library, so  = it seems that there are many dependent objects above should have to be = included,  that would be suffering problem to be fixed below during = doing this,

 

There are many platform = dependent source code i.e. cpus.c memory.c, how to compile them into so = for specific platform? Is there some guidance for building qemu to so? = could you give help on this?

 

Thanks a = lot!

 

Best = Regards

Halsey = Pian

 

------=_NextPart_000_000D_01D02B3B.00DC8060--