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 (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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to