* [PATCH] kvm tools: Add build target for statically-linked binary
@ 2012-01-09 5:10 Matt Evans
2012-01-09 6:45 ` [PATCH V2] " Matt Evans
0 siblings, 1 reply; 8+ messages in thread
From: Matt Evans @ 2012-01-09 5:10 UTC (permalink / raw)
To: KVM list; +Cc: Pekka Enberg, Sasha Levin
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.)
Signed-off-by: Matt Evans <matt@ozlabs.org>
---
Pekka, I found this useful in one of our test setups, hopefully
others will too.
Cheers, Matt
tools/kvm/Makefile | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index ce3df65..309cc6b 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) $@
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-09 5:10 [PATCH] kvm tools: Add build target for statically-linked binary Matt Evans
@ 2012-01-09 6:45 ` Matt Evans
2012-01-09 7:07 ` Pekka Enberg
2012-01-09 7:51 ` Asias He
0 siblings, 2 replies; 8+ messages in thread
From: Matt Evans @ 2012-01-09 6:45 UTC (permalink / raw)
To: KVM list; +Cc: Pekka Enberg, Sasha Levin
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.)
Signed-off-by: Matt Evans <matt@ozlabs.org>
---
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
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-09 6:45 ` [PATCH V2] " Matt Evans
@ 2012-01-09 7:07 ` Pekka Enberg
2012-01-09 12:09 ` Sasha Levin
2012-01-09 7:51 ` Asias He
1 sibling, 1 reply; 8+ messages in thread
From: Pekka Enberg @ 2012-01-09 7:07 UTC (permalink / raw)
To: Matt Evans; +Cc: KVM list, Sasha Levin, mingo
On Mon, 9 Jan 2012, 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.)
>
> Signed-off-by: Matt Evans <matt@ozlabs.org>
I'm fine with this. Ingo, Sasha?
> ---
>
> 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
> --
> 1.7.0.4
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-09 6:45 ` [PATCH V2] " Matt Evans
2012-01-09 7:07 ` Pekka Enberg
@ 2012-01-09 7:51 ` Asias He
2012-01-30 3:18 ` Matt Evans
1 sibling, 1 reply; 8+ messages in thread
From: Asias He @ 2012-01-09 7:51 UTC (permalink / raw)
To: Matt Evans; +Cc: KVM list, Pekka Enberg, Sasha Levin
[-- Attachment #1: Type: text/plain, Size: 1462 bytes --]
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.
>
> Signed-off-by: Matt Evans <matt@ozlabs.org>
> ---
>
> 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
--
Asias He
[-- Attachment #2: build.log.gz --]
[-- Type: application/gzip, Size: 9680 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-09 7:07 ` Pekka Enberg
@ 2012-01-09 12:09 ` Sasha Levin
0 siblings, 0 replies; 8+ messages in thread
From: Sasha Levin @ 2012-01-09 12:09 UTC (permalink / raw)
To: Pekka Enberg; +Cc: Matt Evans, KVM list, mingo
On Mon, 2012-01-09 at 09:07 +0200, Pekka Enberg wrote:
> On Mon, 9 Jan 2012, 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.)
> >
> > Signed-off-by: Matt Evans <matt@ozlabs.org>
>
> I'm fine with this. Ingo, Sasha?
The tool has some dependencies which are currently dynamically linked,
we should either link them statically or disable them if we can't do
that.
--
Sasha.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-09 7:51 ` Asias He
@ 2012-01-30 3:18 ` Matt Evans
2012-01-30 3:51 ` Sasha Levin
0 siblings, 1 reply; 8+ messages in thread
From: Matt Evans @ 2012-01-30 3:18 UTC (permalink / raw)
To: Asias He; +Cc: KVM list, Pekka Enberg, Sasha Levin
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 <matt@ozlabs.org>
>> ---
>>
>> 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
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-30 3:18 ` Matt Evans
@ 2012-01-30 3:51 ` Sasha Levin
2012-01-30 3:58 ` Matt Evans
0 siblings, 1 reply; 8+ messages in thread
From: Sasha Levin @ 2012-01-30 3:51 UTC (permalink / raw)
To: Matt Evans; +Cc: Asias He, KVM list, Pekka Enberg
On Mon, 2012-01-30 at 14:18 +1100, Matt Evans wrote:
> 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?
How about we do it as a 'make static' target which will generate a
static binary without optional libraries (or just libs that don't link
statically)?
--
Sasha.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] kvm tools: Add build target for statically-linked binary
2012-01-30 3:51 ` Sasha Levin
@ 2012-01-30 3:58 ` Matt Evans
0 siblings, 0 replies; 8+ messages in thread
From: Matt Evans @ 2012-01-30 3:58 UTC (permalink / raw)
To: Sasha Levin; +Cc: Asias He, KVM list, Pekka Enberg
On 30/01/12 14:51, Sasha Levin wrote:
> On Mon, 2012-01-30 at 14:18 +1100, Matt Evans wrote:
>> 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?
>
> How about we do it as a 'make static' target which will generate a
> static binary without optional libraries (or just libs that don't link
> statically)?
Sure, but that was my question: how? That 'make static' target can drop -lbfd,
-lSDL etc. from the link line but all of the '.o's that we've already built
either may depend on one of those libs or may do something different because
CONFIG_HAS_SDL (or similar) was set. The only way I can think of doing this is
to have 'make static' depend on a second set of
$(all_objects_except_without_optional_libs) which are built without
CONFIG_HAS_SDL etc., but that'd make Makefile fugly IMHO.
Unless, that is, CFLAGS (and thus CONFIG_HAS_SDL, has_SDL probing, etc.) can
somehow change depending on the make target.
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-30 3:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 5:10 [PATCH] kvm tools: Add build target for statically-linked binary Matt Evans
2012-01-09 6:45 ` [PATCH V2] " Matt Evans
2012-01-09 7:07 ` Pekka Enberg
2012-01-09 12:09 ` Sasha Levin
2012-01-09 7:51 ` Asias He
2012-01-30 3:18 ` Matt Evans
2012-01-30 3:51 ` Sasha Levin
2012-01-30 3:58 ` Matt Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox