diff mbox

[RFC] Makefile.target: prepend $libs_softmmu to $LIBS

Message ID 54FEC488.20007@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini March 10, 2015, 10:16 a.m. UTC
On 09/03/2015 15:54, Wei Liu wrote:
> I discovered a problem when trying to build QEMU statically with gcc.
> libm is an element of LIBS while libpixman-1 is an element in
> libs_softmmu. Libpixman references functions in libm, so the original
> ordering makes linking fail.
> 
> This fix is to reorder $libs_softmmu and $LIBS to make -lm appear after
> -lpixman-1. However I'm not quite sure if this is the right fix, hence
> the RFC tag.
> 
> Normally QEMU is built with c++ compiler which happens to link in libm
> (at least this is the case with g++), so building QEMU statically
> normally just works and nobody notices this issue.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>  Makefile.target | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.target b/Makefile.target
> index 2262d89..1083377 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -134,7 +134,7 @@ obj-$(CONFIG_KVM) += kvm-all.o
>  obj-y += memory.o savevm.o cputlb.o
>  obj-y += memory_mapping.o
>  obj-y += dump.o
> -LIBS+=$(libs_softmmu)
> +LIBS := $(libs_softmmu) $(LIBS)

A side effect of the patch is that changes to libs_softmmu do not
propagate into LIBS.  So you also need this:



Because there are pending changes to OpenGL detection, I'll keep
this patch queued in my tree and will probably submit it only for
2.4.

Paolo

Comments

Wei Liu March 10, 2015, 11:57 a.m. UTC | #1
On Tue, Mar 10, 2015 at 11:16:40AM +0100, Paolo Bonzini wrote:
> 
> 
> On 09/03/2015 15:54, Wei Liu wrote:
> > I discovered a problem when trying to build QEMU statically with gcc.
> > libm is an element of LIBS while libpixman-1 is an element in
> > libs_softmmu. Libpixman references functions in libm, so the original
> > ordering makes linking fail.
> > 
> > This fix is to reorder $libs_softmmu and $LIBS to make -lm appear after
> > -lpixman-1. However I'm not quite sure if this is the right fix, hence
> > the RFC tag.
> > 
> > Normally QEMU is built with c++ compiler which happens to link in libm
> > (at least this is the case with g++), so building QEMU statically
> > normally just works and nobody notices this issue.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> >  Makefile.target | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Makefile.target b/Makefile.target
> > index 2262d89..1083377 100644
> > --- a/Makefile.target
> > +++ b/Makefile.target
> > @@ -134,7 +134,7 @@ obj-$(CONFIG_KVM) += kvm-all.o
> >  obj-y += memory.o savevm.o cputlb.o
> >  obj-y += memory_mapping.o
> >  obj-y += dump.o
> > -LIBS+=$(libs_softmmu)
> > +LIBS := $(libs_softmmu) $(LIBS)
> 
> A side effect of the patch is that changes to libs_softmmu do not
> propagate into LIBS.  So you also need this:
> 
> diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
> index 7ed76a9..4eb9e98 100644
> --- a/hw/display/Makefile.objs
> +++ b/hw/display/Makefile.objs
> @@ -20,7 +20,7 @@ common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
>  
>  ifeq ($(CONFIG_MILKYMIST_TMU2),y)
>  common-obj-y += milkymist-tmu2.o
> -libs_softmmu += $(GLX_LIBS)
> +milkymist-tmu2.o-libs += $(GLX_LIBS)
>  endif
>  
>  obj-$(CONFIG_OMAP) += omap_dss.o
> 
> 
> Because there are pending changes to OpenGL detection, I'll keep
> this patch queued in my tree and will probably submit it only for
> 2.4.

I don't quite follow. Do you want me to carry your patch in my own tree,
wait for you to submit your patch (and get merged), then I submit my
patch again?

Wei.

> 
> Paolo
Paolo Bonzini March 10, 2015, noon UTC | #2
On 10/03/2015 12:57, Wei Liu wrote:
> > Because there are pending changes to OpenGL detection, I'll keep
> > this patch queued in my tree and will probably submit it only for
> > 2.4.
>
> I don't quite follow. Do you want me to carry your patch in my own tree,
> wait for you to submit your patch (and get merged), then I submit my
> patch again?

I'll submit a pull request for your patch, but it will likely have to
wait for QEMU 2.4.

Paolo
Wei Liu March 10, 2015, 12:02 p.m. UTC | #3
On Tue, Mar 10, 2015 at 01:00:15PM +0100, Paolo Bonzini wrote:
> 
> 
> On 10/03/2015 12:57, Wei Liu wrote:
> > > Because there are pending changes to OpenGL detection, I'll keep
> > > this patch queued in my tree and will probably submit it only for
> > > 2.4.
> >
> > I don't quite follow. Do you want me to carry your patch in my own tree,
> > wait for you to submit your patch (and get merged), then I submit my
> > patch again?
> 
> I'll submit a pull request for your patch, but it will likely have to
> wait for QEMU 2.4.
> 

That's fine by me. It's not urgent.

Wei.

> Paolo
diff mbox

Patch

diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index 7ed76a9..4eb9e98 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -20,7 +20,7 @@  common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
 
 ifeq ($(CONFIG_MILKYMIST_TMU2),y)
 common-obj-y += milkymist-tmu2.o
-libs_softmmu += $(GLX_LIBS)
+milkymist-tmu2.o-libs += $(GLX_LIBS)
 endif
 
 obj-$(CONFIG_OMAP) += omap_dss.o