From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAUaG-0000zn-LM for qemu-devel@nongnu.org; Sun, 11 Jan 2015 21:18:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAUaD-0000iM-Ak for qemu-devel@nongnu.org; Sun, 11 Jan 2015 21:18:24 -0500 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]:39212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAUaC-0000gb-R9 for qemu-devel@nongnu.org; Sun, 11 Jan 2015 21:18:21 -0500 Received: by mail-pa0-f51.google.com with SMTP id ey11so29326785pad.10 for ; Sun, 11 Jan 2015 18:18:19 -0800 (PST) Received: from HalseyPC ([103.242.168.62]) by mx.google.com with ESMTPSA id ts5sm12725946pbc.88.2015.01.11.18.18.16 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Jan 2015 18:18:18 -0800 (PST) From: "Halsey Pian" References: In-Reply-To: Date: Mon, 12 Jan 2015 10:18:06 +0800 Message-ID: <005801d02e0e$07268850$157398f0$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0059_01D02E51.154C1240" 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_0059_01D02E51.154C1240 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Hi All, =20 I have a workaround solution to achieve this. I could just get all the = object files required by specific platform executable binary by adding some codes in Makefile, and then compile them to the dynamic = library. Sorry for reading this mail thread. Please ignore it. Thanks!=20 =20 =20 =20 Best Regards Halsey Pian =20 From: Halsey Pian [mailto:halsey.pian@gmail.com]=20 Sent: 2015=C4=EA1=D4=C28=C8=D5 12:03 To: qemu-devel@nongnu.org Subject: RE: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library =20 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_0059_01D02E51.154C1240 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Hi All,

 

I have a workaround = solution to achieve this. I could just get all the object files required = by specific platform executable binary by adding some codes in Makefile, = and then compile them to the dynamic library.  Sorry for reading = this mail thread. Please ignore it. Thanks!

 

 

 

Best = Regards

Halsey = Pian

 

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

 

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_0059_01D02E51.154C1240--