From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Evans Subject: Re: [PATCH V2] kvm tools: Add build target for statically-linked binary Date: Mon, 30 Jan 2012 14:18:02 +1100 Message-ID: <4F260BEA.5030606@ozlabs.org> References: <4F0A76AD.6070506@ozlabs.org> <4F0A8D22.1030302@ozlabs.org> <4F0A9C6D.9030003@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: KVM list , Pekka Enberg , Sasha Levin To: Asias He Return-path: Received: from ozlabs.org ([203.10.76.45]:36340 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753081Ab2A3DR7 (ORCPT ); Sun, 29 Jan 2012 22:17:59 -0500 In-Reply-To: <4F0A9C6D.9030003@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi Asias, Remember this patch? :-) I didn't... oops. On 09/01/12 18:51, Asias He wrote: > On 01/09/2012 02:45 PM, Matt Evans wrote: >> This commit adds a target for 'lkvm-static' which is linked -static. >> >> (This can be useful to construct kvmtool binaries for minimalist >> auto-test host filesystems.) > > This is useful. However, It fails to build for me. Some problem with > sdl, bfd and vnc library. Log attached. OK, so I've been building statically without the (autodetected) SDL/BFD/VNC libraries, and this works fine on PPC64 and x86. I'm not quite sure why the libSDL.a/libbfd.a etc. don't statically link. Sasha's idea of "disable things that don't link correctly" is a good one, though I'm not a Make guru and can't see how to retrospectively unset 'has_SDL', 'has_vncserver' etc. IFF the makefile target is lkvm-static :( (I guess one way is to try to find every .o that depends on CONFIG_SDL, for example, and add another target compiled without -DCONFIG_SDL :( Ew, and I don't know how to do this.) This would be easier if we had a proper config system.. In lieu of any good lightweight solutions, can we include this patch as it is still useful for builds on systems without the offending optional libraries? Cheers, Matt > >> >> Signed-off-by: Matt Evans >> --- >> >> V2: Argh! Let's remove it on make clean, too... >> >> tools/kvm/Makefile | 6 +++++- >> 1 files changed, 5 insertions(+), 1 deletions(-) >> >> diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile >> index d54fa47..ebc0c7c 100644 >> --- a/tools/kvm/Makefile >> +++ b/tools/kvm/Makefile >> @@ -233,6 +233,10 @@ $(PROGRAM): $(DEPS) $(OBJS) >> $(E) " LINK " $@ >> $(Q) $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@ >> >> +$(PROGRAM)-static: $(DEPS) $(OBJS) >> + $(E) " LINK " $@ >> + $(Q) $(CC) -static $(CFLAGS) $(OBJS) $(LIBS) -o $@ >> + >> $(PROGRAM_ALIAS): $(PROGRAM) >> $(E) " LN " $@ >> $(Q) ln -f $(PROGRAM) $@ >> @@ -325,7 +329,7 @@ clean: >> $(Q) rm -f x86/bios/bios-rom.h >> $(Q) rm -f tests/boot/boot_test.iso >> $(Q) rm -rf tests/boot/rootfs/ >> - $(Q) rm -f $(DEPS) $(OBJS) $(PROGRAM) $(PROGRAM_ALIAS) $(GUEST_INIT) $(GUEST_INIT_S2) >> + $(Q) rm -f $(DEPS) $(OBJS) $(PROGRAM) $(PROGRAM_ALIAS) $(PROGRAM)-static $(GUEST_INIT) $(GUEST_INIT_S2) >> $(Q) rm -f cscope.* >> $(Q) rm -f $(KVM_INCLUDE)/common-cmds.h >> $(Q) rm -f KVMTOOLS-VERSION-FILE > >