Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-09 Thread Wei Liu
On Fri, Mar 09, 2018 at 12:08:42PM +0100, Olaf Hering wrote:
> On Fri, Mar 09, Olaf Hering wrote:
> 
> > abuild@latitude:~> readelf -Wa /usr/lib64/libpython2.7.so | grep dlsym
> > 003e5e08  00d90007 R_X86_64_JUMP_SLOT  
> > dlsym@GLIBC_2.2.5 + 0
> >217:  0 FUNCGLOBAL DEFAULT  UND 
> > dlsym@GLIBC_2.2.5 (10)
> > abuild@latitude:~> readelf -Wa /usr/lib64/libxenstore.so | grep dlsym
> > 002071b0  002b0007 R_X86_64_JUMP_SLOT  
> > dlsym + 0
> > 43:  0 NOTYPE  GLOBAL DEFAULT  UND dlsym
> 
> The difference is SUSE_ASNEEDED=1 in environment.
> If it is set, libxenstore.so will not link to libdl.so.
> If it is not, libxenstore.so will link to libdl.so.
> Since package building exports SUSE_ASNEEDED=1 usage of -lxenstore will
> fail. Not sure how all the other packages use dlsym(), clearly xenstore
> does something different.

I'm not sure what to make of this. I'm not sure what SUSE_ASNEEDED is
for. I guess I will leave this to you SuSE experts to sort out. :-)

Wei.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-09 Thread Olaf Hering
On Fri, Mar 09, Olaf Hering wrote:

> abuild@latitude:~> readelf -Wa /usr/lib64/libpython2.7.so | grep dlsym
> 003e5e08  00d90007 R_X86_64_JUMP_SLOT  
> dlsym@GLIBC_2.2.5 + 0
>217:  0 FUNCGLOBAL DEFAULT  UND dlsym@GLIBC_2.2.5 
> (10)
> abuild@latitude:~> readelf -Wa /usr/lib64/libxenstore.so | grep dlsym
> 002071b0  002b0007 R_X86_64_JUMP_SLOT  
> dlsym + 0
> 43:  0 NOTYPE  GLOBAL DEFAULT  UND dlsym

The difference is SUSE_ASNEEDED=1 in environment.
If it is set, libxenstore.so will not link to libdl.so.
If it is not, libxenstore.so will link to libdl.so.
Since package building exports SUSE_ASNEEDED=1 usage of -lxenstore will
fail. Not sure how all the other packages use dlsym(), clearly xenstore
does something different.

Olaf


signature.asc
Description: PGP signature
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-09 Thread Olaf Hering
On Fri, Mar 09, Juergen Gross wrote:

> So how does this work?

No idea, at least this output differs:

abuild@latitude:~> readelf -Wa /usr/lib64/libpython2.7.so | grep dlsym
003e5e08  00d90007 R_X86_64_JUMP_SLOT  
dlsym@GLIBC_2.2.5 + 0
   217:  0 FUNCGLOBAL DEFAULT  UND dlsym@GLIBC_2.2.5 
(10)
abuild@latitude:~> readelf -Wa /usr/lib64/libxenstore.so | grep dlsym
002071b0  002b0007 R_X86_64_JUMP_SLOT  
dlsym + 0
43:  0 NOTYPE  GLOBAL DEFAULT  UND dlsym

Olaf


signature.asc
Description: PGP signature
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-09 Thread Juergen Gross
On 09/03/18 09:36, Olaf Hering wrote:
> On Wed, Mar 07, Juergen Gross wrote:
> 
>> On 07/03/18 13:06, ian.jack...@citrix.com wrote:
>>> Juergen Gross writes ("Re: [PATCH] tools/xenstore: add libdl dependency to 
>>> libxenstore"):
 On 07/03/18 12:19, Ian Jackson wrote:
> Juergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to 
> libxenstore"):
>>  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
>> +else
>> +PKG_CONFIG_REMOVE += dl
> What is this ?
 -ldl is needed on Linux only, but I didn't want to add a Linux specific
 pkg-config file. So I'm removing the dependency in case we are not on
 Linux.
>>> Sorry, I was grepping an older xen tree, so I didn't see where this
>>> variable was honoured.
>>> Will this work, though, when what has to be done is to remove -ldl
>>> from Libs, rather than from Requires ?
>> Yes, I've tested it to work (in V2 we have: PKG_CONFIG_REMOVE += -ldl)
> 
> This breaks libvirt.
> m4/virt-driver-xen.m4 tries to use just '-lxenstore' and the test fails
> with missing 'dlsym'. If I adjust this .m4 file to use pkgconfig it
> still fails. Only appending '-ldl' to XEN_LIBS will help. So to me it
> looks like -ldl is now a hard requirement when linking to
> libxenstore.so. I used 20180307T163340.c9bd8a7365 for testing.

It seems as if some information in libxenstore.so is missing.

E.g. libpython2.7.so is linked against libdl.so. It is possible to just
link any program with libpython2.7.so without having to specify -ldl:

$ gcc -o cpuid cpuid.c -lpython2.7
$ ldd cpuid
linux-vdso.so.1 (0x7fffbe9bf000)
libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0
(0x7f70bd56)
libc.so.6 => /lib64/libc.so.6 (0x7f70bd1bb000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x7f70bcf9e000)
libdl.so.2 => /lib64/libdl.so.2 (0x7f70bcd9a000)
libutil.so.1 => /lib64/libutil.so.1 (0x7f70bcb97000)
libm.so.6 => /lib64/libm.so.6 (0x7f70bc89a000)
/lib64/ld-linux-x86-64.so.2 (0x7f70bd96e000)

$ cat /usr/lib64/pkgconfig/python-2.7.pc
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

Name: Python
Description: Python library
Requires:
Version: 2.7
Libs.private: -lpthread -ldl  -lutil
Libs: -L${libdir} -lpython2.7
Cflags: -I${includedir}/python2.7


So how does this work?


Juergen

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-09 Thread Olaf Hering
On Wed, Mar 07, Juergen Gross wrote:

> On 07/03/18 13:06, ian.jack...@citrix.com wrote:
> > Juergen Gross writes ("Re: [PATCH] tools/xenstore: add libdl dependency to 
> > libxenstore"):
> >> On 07/03/18 12:19, Ian Jackson wrote:
> >>> Juergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to 
> >>> libxenstore"):
>   libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
>  +else
>  +PKG_CONFIG_REMOVE += dl
> >>> What is this ?
> >> -ldl is needed on Linux only, but I didn't want to add a Linux specific
> >> pkg-config file. So I'm removing the dependency in case we are not on
> >> Linux.
> > Sorry, I was grepping an older xen tree, so I didn't see where this
> > variable was honoured.
> > Will this work, though, when what has to be done is to remove -ldl
> > from Libs, rather than from Requires ?
> Yes, I've tested it to work (in V2 we have: PKG_CONFIG_REMOVE += -ldl)

This breaks libvirt.
m4/virt-driver-xen.m4 tries to use just '-lxenstore' and the test fails
with missing 'dlsym'. If I adjust this .m4 file to use pkgconfig it
still fails. Only appending '-ldl' to XEN_LIBS will help. So to me it
looks like -ldl is now a hard requirement when linking to
libxenstore.so. I used 20180307T163340.c9bd8a7365 for testing.

Olaf


signature.asc
Description: PGP signature
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread Juergen Gross
On 07/03/18 13:06, ian.jack...@citrix.com wrote:
> Juergen Gross writes ("Re: [PATCH] tools/xenstore: add libdl dependency to 
> libxenstore"):
>> On 07/03/18 12:19, Ian Jackson wrote:
>>> Juergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to 
>>> libxenstore"):
  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
 +else
 +PKG_CONFIG_REMOVE += dl
>>>
>>> What is this ?
>>
>> -ldl is needed on Linux only, but I didn't want to add a Linux specific
>> pkg-config file. So I'm removing the dependency in case we are not on
>> Linux.
> 
> Sorry, I was grepping an older xen tree, so I didn't see where this
> variable was honoured.
> 
> Will this work, though, when what has to be done is to remove -ldl
> from Libs, rather than from Requires ?

Yes, I've tested it to work (in V2 we have: PKG_CONFIG_REMOVE += -ldl)


Juergen

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread ian.jackson
Juergen Gross writes ("Re: [PATCH] tools/xenstore: add libdl dependency to 
libxenstore"):
> On 07/03/18 12:19, Ian Jackson wrote:
> > Juergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to 
> > libxenstore"):
> >>  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
> >> +else
> >> +PKG_CONFIG_REMOVE += dl
> > 
> > What is this ?
> 
> -ldl is needed on Linux only, but I didn't want to add a Linux specific
> pkg-config file. So I'm removing the dependency in case we are not on
> Linux.

Sorry, I was grepping an older xen tree, so I didn't see where this
variable was honoured.

Will this work, though, when what has to be done is to remove -ldl
from Libs, rather than from Requires ?

Ian.



___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread Juergen Gross
On 07/03/18 12:19, Ian Jackson wrote:
> Juergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to 
> libxenstore"):
>>  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
>> +else
>> +PKG_CONFIG_REMOVE += dl
> 
> What is this ?

-ldl is needed on Linux only, but I didn't want to add a Linux specific
pkg-config file. So I'm removing the dependency in case we are not on
Linux.


Juergen

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread Wei Liu
On Wed, Mar 07, 2018 at 12:01:25PM +0100, Juergen Gross wrote:
> On 07/03/18 11:17, Juergen Gross wrote:
> > Commit 448c03b3cbe14873ee63 ("tools/xenstore: try to get minimum thread
> > stack size for watch thread") added a dependency to libdl to
> > libxenstore.
> > 
> > Add the needed flags to LDLIBS_libxenstore and the pkg-config file of
> > libxenstore.
> > 
> > Fixes: 448c03b3cbe14873ee63
> > Signed-off-by: Juergen Gross 
> > Tested-by: Olaf Hering 
> > ---
> >  tools/Rules.mk| 3 +++
> >  tools/xenstore/Makefile   | 2 ++
> >  tools/xenstore/xenstore.pc.in | 2 +-
> >  3 files changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/Rules.mk b/tools/Rules.mk
> > index 61515d3063..296b722372 100644
> > --- a/tools/Rules.mk
> > +++ b/tools/Rules.mk
> > @@ -149,6 +149,9 @@ CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include 
> > $(CFLAGS_xeninclude)
> >  SHDEPS_libxenstore = $(SHLIB_libxentoolcore)
> >  LDLIBS_libxenstore = $(SHDEPS_libxenstore) 
> > $(XEN_XENSTORE)/libxenstore$(libextension)
> >  SHLIB_libxenstore  = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_XENSTORE)
> > +ifeq ($(CONFIG_Linux),y)
> > +LDLIBS_libxenstore += -ldl
> > +endif
> >  
> >  CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
> >  SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
> > diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> > index 0831be0b6f..aeee819748 100644
> > --- a/tools/xenstore/Makefile
> > +++ b/tools/xenstore/Makefile
> > @@ -103,6 +103,8 @@ xs.opic: CFLAGS += -DUSE_PTHREAD
> >  ifeq ($(CONFIG_Linux),y)
> >  xs.opic: CFLAGS += -DUSE_DLSYM
> >  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
> > +else
> > +PKG_CONFIG_REMOVE += dl
> >  endif
> >  
> >  libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
> > diff --git a/tools/xenstore/xenstore.pc.in b/tools/xenstore/xenstore.pc.in
> > index 6fd72a1f17..4fc37f805b 100644
> > --- a/tools/xenstore/xenstore.pc.in
> > +++ b/tools/xenstore/xenstore.pc.in
> > @@ -7,4 +7,4 @@ Description: The Xenstore library for Xen hypervisor
> >  Version: @@version@@
> >  Cflags: -I${includedir} @@cflagslocal@@
> >  Libs: @@libsflag@@${libdir} -lxenstore
> > -Requires.private: xenevtchn,xencontrol,xengnttab,xentoolcore
> > +Requires.private: xenevtchn,xencontrol,xengnttab,xentoolcore,dl
> 
> Uuh, this was wrong. libdl hasn't got a pkgconfig file, so we need to
> add -ldl to Libs.private instead. V2 coming soon...
> 

Luckily I haven't got around to apply it...

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread Juergen Gross
On 07/03/18 11:17, Juergen Gross wrote:
> Commit 448c03b3cbe14873ee63 ("tools/xenstore: try to get minimum thread
> stack size for watch thread") added a dependency to libdl to
> libxenstore.
> 
> Add the needed flags to LDLIBS_libxenstore and the pkg-config file of
> libxenstore.
> 
> Fixes: 448c03b3cbe14873ee63
> Signed-off-by: Juergen Gross 
> Tested-by: Olaf Hering 
> ---
>  tools/Rules.mk| 3 +++
>  tools/xenstore/Makefile   | 2 ++
>  tools/xenstore/xenstore.pc.in | 2 +-
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/Rules.mk b/tools/Rules.mk
> index 61515d3063..296b722372 100644
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -149,6 +149,9 @@ CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include 
> $(CFLAGS_xeninclude)
>  SHDEPS_libxenstore = $(SHLIB_libxentoolcore)
>  LDLIBS_libxenstore = $(SHDEPS_libxenstore) 
> $(XEN_XENSTORE)/libxenstore$(libextension)
>  SHLIB_libxenstore  = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_XENSTORE)
> +ifeq ($(CONFIG_Linux),y)
> +LDLIBS_libxenstore += -ldl
> +endif
>  
>  CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
>  SHDEPS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
> diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
> index 0831be0b6f..aeee819748 100644
> --- a/tools/xenstore/Makefile
> +++ b/tools/xenstore/Makefile
> @@ -103,6 +103,8 @@ xs.opic: CFLAGS += -DUSE_PTHREAD
>  ifeq ($(CONFIG_Linux),y)
>  xs.opic: CFLAGS += -DUSE_DLSYM
>  libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
> +else
> +PKG_CONFIG_REMOVE += dl
>  endif
>  
>  libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
> diff --git a/tools/xenstore/xenstore.pc.in b/tools/xenstore/xenstore.pc.in
> index 6fd72a1f17..4fc37f805b 100644
> --- a/tools/xenstore/xenstore.pc.in
> +++ b/tools/xenstore/xenstore.pc.in
> @@ -7,4 +7,4 @@ Description: The Xenstore library for Xen hypervisor
>  Version: @@version@@
>  Cflags: -I${includedir} @@cflagslocal@@
>  Libs: @@libsflag@@${libdir} -lxenstore
> -Requires.private: xenevtchn,xencontrol,xengnttab,xentoolcore
> +Requires.private: xenevtchn,xencontrol,xengnttab,xentoolcore,dl

Uuh, this was wrong. libdl hasn't got a pkgconfig file, so we need to
add -ldl to Libs.private instead. V2 coming soon...


Juergen


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH] tools/xenstore: add libdl dependency to libxenstore

2018-03-07 Thread Wei Liu
On Wed, Mar 07, 2018 at 11:17:44AM +0100, Juergen Gross wrote:
> Commit 448c03b3cbe14873ee63 ("tools/xenstore: try to get minimum thread
> stack size for watch thread") added a dependency to libdl to
> libxenstore.
> 
> Add the needed flags to LDLIBS_libxenstore and the pkg-config file of
> libxenstore.
> 
> Fixes: 448c03b3cbe14873ee63
> Signed-off-by: Juergen Gross 
> Tested-by: Olaf Hering 

Acked-by: Wei Liu 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel