diff mbox

QEMU build breakage on ARM against Xen 4.9 caused by libxendevicemodel

Message ID 20170503164838.GB1553@perard.uk.xensource.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anthony PERARD May 3, 2017, 4:48 p.m. UTC
On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> On Thu, 20 Apr 2017, Paul Durrant wrote:
> > I think xencall should be part of the base xen_stable_libs anyway.
> 
> Yes, you are right. However I noticed that -lxencall needs to come after
> -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> $xen_stable_libs, see below. I'll merge this patch into "configure:
> detect presence of libxendevicemodel", if that's OK.
> 
> diff --git a/configure b/configure
> index 99d6cbc..3133ef8 100755
> --- a/configure
> +++ b/configure
> @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
>    else
>  
>      xen_libs="-lxenstore -lxenctrl -lxenguest"
> -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
>  
>      # First we test whether Xen headers and libraries are available.
>      # If no, we are done and there is no Xen support.
> @@ -2027,9 +2027,9 @@ int main(void) {
>    return 0;
>  }
>  EOF
> -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
>        then
> -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
>        xen_ctrl_version=40900
>        xen=yes
>      elif

Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
qemu-mainline branch fail.)

That's because -lxencall is not found because -L$path_to_libxencall is
missing in xen.git.

But I've notice something else, libxendevicemodel.so is not linked
against libxencall, that might be the root of the issues on arm.
(libxenctrl.so is linked against libxencall.)

Thought?


We probably need this patch in xen:

Comments

Wei Liu May 3, 2017, 4:52 p.m. UTC | #1
On Wed, May 03, 2017 at 05:48:38PM +0100, Anthony PERARD wrote:
> On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > I think xencall should be part of the base xen_stable_libs anyway.
> > 
> > Yes, you are right. However I noticed that -lxencall needs to come after
> > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > detect presence of libxendevicemodel", if that's OK.
> > 
> > diff --git a/configure b/configure
> > index 99d6cbc..3133ef8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> >    else
> >  
> >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> >  
> >      # First we test whether Xen headers and libraries are available.
> >      # If no, we are done and there is no Xen support.
> > @@ -2027,9 +2027,9 @@ int main(void) {
> >    return 0;
> >  }
> >  EOF
> > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> >        then
> > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> >        xen_ctrl_version=40900
> >        xen=yes
> >      elif
> 
> Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> qemu-mainline branch fail.)
> 
> That's because -lxencall is not found because -L$path_to_libxencall is
> missing in xen.git.
> 
> But I've notice something else, libxendevicemodel.so is not linked
> against libxencall, that might be the root of the issues on arm.
> (libxenctrl.so is linked against libxencall.)
> 
> Thought?
> 
> 
> We probably need this patch in xen:
> 
> diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> index 55626a5049..81fa5a4ac4 100644
> --- a/tools/libs/devicemodel/Makefile
> +++ b/tools/libs/devicemodel/Makefile
> @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
>         $(SYMLINK_SHLIB) $< $@
>  
>  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
>  

Isn't the dependency already encoded in tools/Rules.mk?

>  .PHONY: install
>  install: build
> 
> -- 
> Anthony PERARD
Paul Durrant May 3, 2017, 4:52 p.m. UTC | #2
> -----Original Message-----
> From: Anthony PERARD [mailto:anthony.perard@citrix.com]
> Sent: 03 May 2017 17:49
> To: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Paul Durrant <Paul.Durrant@citrix.com>; qemu-devel@nongnu.org; Wei
> Liu <wei.liu2@citrix.com>; xen-devel@lists.xenproject.org
> Subject: Re: QEMU build breakage on ARM against Xen 4.9 caused by
> libxendevicemodel
> 
> On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > I think xencall should be part of the base xen_stable_libs anyway.
> >
> > Yes, you are right. However I noticed that -lxencall needs to come after
> > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > detect presence of libxendevicemodel", if that's OK.
> >
> > diff --git a/configure b/configure
> > index 99d6cbc..3133ef8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> >    else
> >
> >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -
> lxenevtchn"
> >
> >      # First we test whether Xen headers and libraries are available.
> >      # If no, we are done and there is no Xen support.
> > @@ -2027,9 +2027,9 @@ int main(void) {
> >    return 0;
> >  }
> >  EOF
> > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> >        then
> > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> >        xen_ctrl_version=40900
> >        xen=yes
> >      elif
> 
> Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> qemu-mainline branch fail.)
> 
> That's because -lxencall is not found because -L$path_to_libxencall is
> missing in xen.git.
> 
> But I've notice something else, libxendevicemodel.so is not linked
> against libxencall, that might be the root of the issues on arm.
> (libxenctrl.so is linked against libxencall.)
> 
> Thought?
> 

That's definitely an oversight. It should be linked against libxencall.

  Paul

> 
> We probably need this patch in xen:
> 
> diff --git a/tools/libs/devicemodel/Makefile
> b/tools/libs/devicemodel/Makefile
> index 55626a5049..81fa5a4ac4 100644
> --- a/tools/libs/devicemodel/Makefile
> +++ b/tools/libs/devicemodel/Makefile
> @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR):
> libxendevicemodel.so.$(MAJOR).$(MINOR)
>         $(SYMLINK_SHLIB) $< $@
> 
>  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
> libxendevicemodel.map
> -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -
> Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS)
> $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -
> Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS)
> $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> 
>  .PHONY: install
>  install: build
> 
> --
> Anthony PERARD
Anthony PERARD May 3, 2017, 4:55 p.m. UTC | #3
On Wed, May 03, 2017 at 05:52:07PM +0100, Wei Liu wrote:
> On Wed, May 03, 2017 at 05:48:38PM +0100, Anthony PERARD wrote:
> > On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > > I think xencall should be part of the base xen_stable_libs anyway.
> > > 
> > > Yes, you are right. However I noticed that -lxencall needs to come after
> > > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > > detect presence of libxendevicemodel", if that's OK.
> > > 
> > > diff --git a/configure b/configure
> > > index 99d6cbc..3133ef8 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> > >    else
> > >  
> > >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> > >  
> > >      # First we test whether Xen headers and libraries are available.
> > >      # If no, we are done and there is no Xen support.
> > > @@ -2027,9 +2027,9 @@ int main(void) {
> > >    return 0;
> > >  }
> > >  EOF
> > > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> > >        then
> > > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> > >        xen_ctrl_version=40900
> > >        xen=yes
> > >      elif
> > 
> > Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> > qemu-mainline branch fail.)
> > 
> > That's because -lxencall is not found because -L$path_to_libxencall is
> > missing in xen.git.
> > 
> > But I've notice something else, libxendevicemodel.so is not linked
> > against libxencall, that might be the root of the issues on arm.
> > (libxenctrl.so is linked against libxencall.)
> > 
> > Thought?
> > 
> > 
> > We probably need this patch in xen:
> > 
> > diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> > index 55626a5049..81fa5a4ac4 100644
> > --- a/tools/libs/devicemodel/Makefile
> > +++ b/tools/libs/devicemodel/Makefile
> > @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
> >         $(SYMLINK_SHLIB) $< $@
> >  
> >  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> > -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> > +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> >  
> 
> Isn't the dependency already encoded in tools/Rules.mk?

How? Which makefile variable would include -lxencall in the abrove line?

Also ldd libxendevicemodel.so does not list libxencall.so.
Stefano Stabellini May 3, 2017, 5:20 p.m. UTC | #4
On Wed, 3 May 2017, Anthony PERARD wrote:
> On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > I think xencall should be part of the base xen_stable_libs anyway.
> > 
> > Yes, you are right. However I noticed that -lxencall needs to come after
> > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > detect presence of libxendevicemodel", if that's OK.
> > 
> > diff --git a/configure b/configure
> > index 99d6cbc..3133ef8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> >    else
> >  
> >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> >  
> >      # First we test whether Xen headers and libraries are available.
> >      # If no, we are done and there is no Xen support.
> > @@ -2027,9 +2027,9 @@ int main(void) {
> >    return 0;
> >  }
> >  EOF
> > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> >        then
> > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> >        xen_ctrl_version=40900
> >        xen=yes
> >      elif
> 
> Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> qemu-mainline branch fail.)
> 
> That's because -lxencall is not found because -L$path_to_libxencall is
> missing in xen.git.
> 
> But I've notice something else, libxendevicemodel.so is not linked
> against libxencall, that might be the root of the issues on arm.
> (libxenctrl.so is linked against libxencall.)
> 
> Thought?
> 
> 
> We probably need this patch in xen:

We also need to add -L$path_to_libxencall and -I$path_to_libxencall to
tools/Makefile:subdir-all-qemu-xen-dir.


> diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> index 55626a5049..81fa5a4ac4 100644
> --- a/tools/libs/devicemodel/Makefile
> +++ b/tools/libs/devicemodel/Makefile
> @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
>         $(SYMLINK_SHLIB) $< $@
>  
>  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
>  
>  .PHONY: install
>  install: build
> 
> -- 
> Anthony PERARD
>
Anthony PERARD May 3, 2017, 5:51 p.m. UTC | #5
On Wed, May 03, 2017 at 10:20:59AM -0700, Stefano Stabellini wrote:
> On Wed, 3 May 2017, Anthony PERARD wrote:
> > On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > > I think xencall should be part of the base xen_stable_libs anyway.
> > > 
> > > Yes, you are right. However I noticed that -lxencall needs to come after
> > > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > > detect presence of libxendevicemodel", if that's OK.
> > > 
> > > diff --git a/configure b/configure
> > > index 99d6cbc..3133ef8 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> > >    else
> > >  
> > >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> > >  
> > >      # First we test whether Xen headers and libraries are available.
> > >      # If no, we are done and there is no Xen support.
> > > @@ -2027,9 +2027,9 @@ int main(void) {
> > >    return 0;
> > >  }
> > >  EOF
> > > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> > >        then
> > > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> > >        xen_ctrl_version=40900
> > >        xen=yes
> > >      elif
> > 
> > Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> > qemu-mainline branch fail.)
> > 
> > That's because -lxencall is not found because -L$path_to_libxencall is
> > missing in xen.git.
> > 
> > But I've notice something else, libxendevicemodel.so is not linked
> > against libxencall, that might be the root of the issues on arm.
> > (libxenctrl.so is linked against libxencall.)
> > 
> > Thought?
> > 
> > 
> > We probably need this patch in xen:
> 
> We also need to add -L$path_to_libxencall and -I$path_to_libxencall to
> tools/Makefile:subdir-all-qemu-xen-dir.

I don't think that needed because:
for -I, QEMU does not use anything from xencall, and any other includes
does not use xencall.h.

for -L, I think that would be usefull only if QEMU is built staticly.

Also, I don't think -lxencall is needed at all, if libxendevicemodel is
fixed. libxencall will only be a runtime dependency.


> > diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> > index 55626a5049..81fa5a4ac4 100644
> > --- a/tools/libs/devicemodel/Makefile
> > +++ b/tools/libs/devicemodel/Makefile
> > @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
> >         $(SYMLINK_SHLIB) $< $@
> >  
> >  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> > -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> > +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> >  
> >  .PHONY: install
> >  install: build
> > 
> > -- 
> > Anthony PERARD
> >
Stefano Stabellini May 3, 2017, 8:30 p.m. UTC | #6
On Wed, 3 May 2017, Anthony PERARD wrote:
> On Wed, May 03, 2017 at 10:20:59AM -0700, Stefano Stabellini wrote:
> > On Wed, 3 May 2017, Anthony PERARD wrote:
> > > On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > > > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > > > I think xencall should be part of the base xen_stable_libs anyway.
> > > > 
> > > > Yes, you are right. However I noticed that -lxencall needs to come after
> > > > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > > > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > > > detect presence of libxendevicemodel", if that's OK.
> > > > 
> > > > diff --git a/configure b/configure
> > > > index 99d6cbc..3133ef8 100755
> > > > --- a/configure
> > > > +++ b/configure
> > > > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> > > >    else
> > > >  
> > > >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > > > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > > > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> > > >  
> > > >      # First we test whether Xen headers and libraries are available.
> > > >      # If no, we are done and there is no Xen support.
> > > > @@ -2027,9 +2027,9 @@ int main(void) {
> > > >    return 0;
> > > >  }
> > > >  EOF
> > > > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > > > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> > > >        then
> > > > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > > > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> > > >        xen_ctrl_version=40900
> > > >        xen=yes
> > > >      elif
> > > 
> > > Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> > > qemu-mainline branch fail.)
> > > 
> > > That's because -lxencall is not found because -L$path_to_libxencall is
> > > missing in xen.git.
> > > 
> > > But I've notice something else, libxendevicemodel.so is not linked
> > > against libxencall, that might be the root of the issues on arm.
> > > (libxenctrl.so is linked against libxencall.)
> > > 
> > > Thought?
> > > 
> > > 
> > > We probably need this patch in xen:
> > 
> > We also need to add -L$path_to_libxencall and -I$path_to_libxencall to
> > tools/Makefile:subdir-all-qemu-xen-dir.
> 
> I don't think that needed because:
> for -I, QEMU does not use anything from xencall, and any other includes
> does not use xencall.h.
> 
> for -L, I think that would be usefull only if QEMU is built staticly.
> 
> Also, I don't think -lxencall is needed at all, if libxendevicemodel is
> fixed. libxencall will only be a runtime dependency.

I tried the patch below: on ARM, if I remove -L$DIR/tools/libs/call, the
QEMU configure script detects Xen 4.7 instead of 4.9. If I also remove
-Wl,-rpath-link=$DIR/tools/libs/call, it cannot detect Xen at all.

You are right that we can avoid -I and -l, but I think we need both -L
and -Wl,-rpath-link for tools/libs/call.


> > > diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> > > index 55626a5049..81fa5a4ac4 100644
> > > --- a/tools/libs/devicemodel/Makefile
> > > +++ b/tools/libs/devicemodel/Makefile
> > > @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
> > >         $(SYMLINK_SHLIB) $< $@
> > >  
> > >  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> > > -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> > > +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> > >  
> > >  .PHONY: install
> > >  install: build
> > > 
> > > -- 
> > > Anthony PERARD
> > > 
> 
> -- 
> Anthony PERARD
>
Stefano Stabellini May 3, 2017, 8:38 p.m. UTC | #7
On Wed, 3 May 2017, Stefano Stabellini wrote:
> On Wed, 3 May 2017, Anthony PERARD wrote:
> > On Wed, May 03, 2017 at 10:20:59AM -0700, Stefano Stabellini wrote:
> > > On Wed, 3 May 2017, Anthony PERARD wrote:
> > > > On Thu, Apr 20, 2017 at 11:05:33AM -0700, Stefano Stabellini wrote:
> > > > > On Thu, 20 Apr 2017, Paul Durrant wrote:
> > > > > > I think xencall should be part of the base xen_stable_libs anyway.
> > > > > 
> > > > > Yes, you are right. However I noticed that -lxencall needs to come after
> > > > > -lxendevicemodel. So, I'll have to move -lxendevicemodel before
> > > > > $xen_stable_libs, see below. I'll merge this patch into "configure:
> > > > > detect presence of libxendevicemodel", if that's OK.
> > > > > 
> > > > > diff --git a/configure b/configure
> > > > > index 99d6cbc..3133ef8 100755
> > > > > --- a/configure
> > > > > +++ b/configure
> > > > > @@ -1992,7 +1992,7 @@ if test "$xen" != "no" ; then
> > > > >    else
> > > > >  
> > > > >      xen_libs="-lxenstore -lxenctrl -lxenguest"
> > > > > -    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> > > > > +    xen_stable_libs="-lxencall -lxenforeignmemory -lxengnttab -lxenevtchn"
> > > > >  
> > > > >      # First we test whether Xen headers and libraries are available.
> > > > >      # If no, we are done and there is no Xen support.
> > > > > @@ -2027,9 +2027,9 @@ int main(void) {
> > > > >    return 0;
> > > > >  }
> > > > >  EOF
> > > > > -        compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel"
> > > > > +        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
> > > > >        then
> > > > > -      xen_stable_libs="$xen_stable_libs -lxendevicemodel"
> > > > > +      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
> > > > >        xen_ctrl_version=40900
> > > > >        xen=yes
> > > > >      elif
> > > > 
> > > > Hey, now that this patch is merged, xen.git fail to build QEMU. (osstest
> > > > qemu-mainline branch fail.)
> > > > 
> > > > That's because -lxencall is not found because -L$path_to_libxencall is
> > > > missing in xen.git.
> > > > 
> > > > But I've notice something else, libxendevicemodel.so is not linked
> > > > against libxencall, that might be the root of the issues on arm.
> > > > (libxenctrl.so is linked against libxencall.)
> > > > 
> > > > Thought?
> > > > 
> > > > 
> > > > We probably need this patch in xen:
> > > 
> > > We also need to add -L$path_to_libxencall and -I$path_to_libxencall to
> > > tools/Makefile:subdir-all-qemu-xen-dir.
> > 
> > I don't think that needed because:
> > for -I, QEMU does not use anything from xencall, and any other includes
> > does not use xencall.h.
> > 
> > for -L, I think that would be usefull only if QEMU is built staticly.
> > 
> > Also, I don't think -lxencall is needed at all, if libxendevicemodel is
> > fixed. libxencall will only be a runtime dependency.
> 
> I tried the patch below: on ARM, if I remove -L$DIR/tools/libs/call, the
> QEMU configure script detects Xen 4.7 instead of 4.9. If I also remove
> -Wl,-rpath-link=$DIR/tools/libs/call, it cannot detect Xen at all.
> 
> You are right that we can avoid -I and -l, but I think we need both -L
> and -Wl,-rpath-link for tools/libs/call.

Correction: the need for -L$DIR/tools/libs/call comes from -lxencall in
the QEMU configure script. If I remove -lxencall from configure, then it
works OK without it (as it should). But
-Wl,-rpath-link=$DIR/tools/libs/call is still required, otherwise the
xencall library cannot be found and loaded.


> > > > diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
> > > > index 55626a5049..81fa5a4ac4 100644
> > > > --- a/tools/libs/devicemodel/Makefile
> > > > +++ b/tools/libs/devicemodel/Makefile
> > > > @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
> > > >         $(SYMLINK_SHLIB) $< $@
> > > >  
> > > >  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> > > > -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> > > > +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> > > >  
> > > >  .PHONY: install
> > > >  install: build
> > > > 
> > > > -- 
> > > > Anthony PERARD
> > > > 
> > 
> > -- 
> > Anthony PERARD
> > 
>
Wei Liu May 4, 2017, 11:08 a.m. UTC | #8
On Wed, May 03, 2017 at 05:55:36PM +0100, Anthony PERARD wrote:
> > > --- a/tools/libs/devicemodel/Makefile
> > > +++ b/tools/libs/devicemodel/Makefile
> > > @@ -63,7 +63,7 @@ libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
> > >         $(SYMLINK_SHLIB) $< $@
> > >  
> > >  libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
> > > -       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
> > > +       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
> > >  
> > 
> > Isn't the dependency already encoded in tools/Rules.mk?
> 
> How? Which makefile variable would include -lxencall in the abrove line?
> 

I was thinking about SHDEPS_* in Rules.mk. That's for something else.

And you're right. We should fix it here.

Wei.
diff mbox

Patch

diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 55626a5049..81fa5a4ac4 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -63,7 +63,7 @@  libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
        $(SYMLINK_SHLIB) $< $@
 
 libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
-       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(APPEND_LDFLAGS)
+       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: build