tools/xenstore: add libdl dependency to libxenstore
PATCH 1/1 tools/xenstore: add libdl dependency to libxenstore
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.
--- tools/Rules.mk | 3 +++ tools/xenstore/Makefile | 2 ++ tools/xenstore/xenstore.pc.in | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-)
tools/Rules.mk +3 -0
@@ -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)
tools/xenstore/Makefile +2 -0
@@ -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
tools/xenstore/xenstore.pc.in +1 -1
@@ -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
Signature · 7 lines
2.13.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Juergen Gross
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_libxenstoreand the pkg-config file of libxenstore.Fixes 448c03b3cbe14873ee63Signed-off-by Juergen Gross <[email protected]>Tested-by Olaf Hering <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 48 lines · Juergen Gross
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_libxenstoreand the pkg-config file of libxenstore.Fixes 448c03b3cbe14873ee63Signed-off-by Juergen Gross <[email protected]>Tested-by Olaf Hering <[email protected]>--- tools/Rules.mk | 3 +++ tools/xenstore/Makefile | 2 ++ tools/xenstore/xenstore.pc.in | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-)tools/Rules.mk +3
-0@@ -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)tools/xenstore/Makefile +2
-0@@ -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.opictools/xenstore/xenstore.pc.in +0
-0
tools/xenstore/xenstore.pc.in Description: The Xenstore library for Xen hypervisor · line 10
Quoted 5 lines
tools/xenstore/xenstore.pc.in +1
-1@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 43 lines · Juergen Gross
Quoted 42 lines · Juergen Gross
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_libxenstoreand the pkg-config file of libxenstore.Fixes 448c03b3cbe14873ee63Signed-off-by Juergen Gross <[email protected]>Tested-by Olaf Hering <[email protected]>--- tools/Rules.mk | 3 +++ tools/xenstore/Makefile | 2 ++ tools/xenstore/xenstore.pc.in | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-)tools/Rules.mk +3
-0@@ -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)tools/xenstore/Makefile +2
-0@@ -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
Quoted 15 lines
tools/xenstore/xenstore.pc.in Description: The Xenstore library for Xen hypervisor · line 10
Quoted 11 lines
tools/xenstore/Makefile +0
-0libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opictools/xenstore/xenstore.pc.in +1
-1@@ -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,dlUuh, 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/1 tools/xenstore: add libdl dependency to libxenstore
In reply to Juergen GrossJuergen Gross writes ("[PATCH] tools/xenstore: add libdl dependency to libxenstore"):
tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dl
What is this ?
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Ian Jackson
Juergen Gross writes ("[PATCH]
tools/xenstore: add libdl dependency to libxenstore"):tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dlWhat 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross writes ("Re: [PATCH] tools/xenstore: add libdl dependency to libxenstore"):
Quoted 11 lines · Ian Jackson
Quoted 6 lines
Juergen Gross writes ("[PATCH]
tools/xenstore: add libdl dependency to libxenstore"):tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dlWhat 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines · On 07/03/18 13:06, [email protected] wrote:
Juergen Gross writes ("Re: [PATCH]
tools/xenstore: add libdl dependency to libxenstore"):Quoted 11 lines · Ian Jackson
Quoted 6 lines
Juergen Gross writes ("[PATCH]
tools/xenstore: add libdl dependency to libxenstore"):tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dlWhat 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.
Quoted 5 lines
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Juergen Gross
Quoted 7 lines · On 07/03/18 13:06, [email protected] wrote:
Juergen Gross writes ("Re: [PATCH]
tools/xenstore: add libdl dependency to libxenstore"):Quoted 6 lines · Ian Jackson
Quoted 5 lines
Juergen Gross writes ("[PATCH]
tools/xenstore: add libdl dependency to libxenstore"):tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dlWhat is this ?
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
-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
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Olaf Hering
Quoted 15 lines · Juergen Gross
Quoted 14 lines · On 07/03/18 13:06, [email protected] wrote:
Juergen Gross writes ("Re: [PATCH]
tools/xenstore: add libdl dependency to libxenstore"):Quoted 9 lines · Ian Jackson
Quoted 5 lines
Juergen Gross writes ("[PATCH]
tools/xenstore: add libdl dependency to libxenstore"):tools/xenstore/Makefile xs.opic: CFLAGS += -DUSE_PTHREAD · line 107
Quoted 3 lines
libxenstore.so.$(MAJOR).$(MINOR): LDFLAGS += -ldl
tools/xenstore/Makefile +2
-0+else +PKG_CONFIG_REMOVE += dlWhat 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 ?
Quoted 8 lines
Quoted 1 line
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' toXEN_LIBSwill 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 (0x00007fffbe9bf000)
libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0
(0x00007f70bd560000)
libc.so.6 => /lib64/libc.so.6 (0x00007f70bd1bb000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f70bcf9e000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f70bcd9a000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f70bcb97000)
libm.so.6 => /lib64/libm.so.6 (0x00007f70bc89a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f70bd96e000)$ 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Juergen Gross
So how does this work?
No idea, at least this output differs:
abuild@latitude:~> readelf -Wa /usr/lib64/libpython2.7.so | grep dlsym00000000003e5e08 000000d900000007 R_X86_64_JUMP_SLOT 0000000000000000 dlsym@GLIBC_2.2.5 + 0
217: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (10)
abuild@latitude:~> readelf -Wa /usr/lib64/libxenstore.so | grep dlsym00000000002071b0 0000002b00000007 R_X86_64_JUMP_SLOT 0000000000000000 dlsym + 0
43: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND dlsym
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Olaf Hering
abuild@latitude:~> readelf -Wa
/usr/lib64/libpython2.7.so| grep dlsym00000000003e5e08000000d900000007R_X86_64_JUMP_SLOT0000000000000000 dlsym@GLIBC_2.2.5 + 0
217: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (10)
abuild@latitude:~> readelf -Wa/usr/lib64/libxenstore.so| grep dlsym00000000002071b00000002b00000007R_X86_64_JUMP_SLOT0000000000000000 dlsym + 043: 0000000000000000 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
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
abuild@latitude:~> readelf -Wa
/usr/lib64/libpython2.7.so| grep dlsym00000000003e5e08000000d900000007R_X86_64_JUMP_SLOT0000000000000000 dlsym@GLIBC_2.2.5 + 0
217: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (10)
abuild@latitude:~> readelf -Wa/usr/lib64/libxenstore.so| grep dlsym00000000002071b00000002b00000007R_X86_64_JUMP_SLOT0000000000000000 dlsym + 043: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND dlsym
Quoted 6 lines
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 usedlsym(), 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel