[Buildroot] [autobuild.buildroot.net] Your build results for 2018-08-30

Thomas Petazzoni thomas.petazzoni at bootlin.com
Tue Sep 18 21:49:23 UTC 2018


Hello,

On Wed, 5 Sep 2018 00:43:32 +0200, Arnout Vandecappelle wrote:

>  So what does gentoo do? They simply don't have a dependency on util-linux in
> the python3.7.0.ebuild. Indeed, it turns out that the _uuid module is entirely
> optional. It is only used to access the uuid_generate_time_safe() function, but
> the uuid.py module can also get this function through ctypes (i.e. dlopen()). So
> perhaps a simpler solution is to just remove the build-time python3 ->
> util-linux dependency? Runtime is still needed to support the dlopen path.

So I just tested this and for some reason, ctypes doesn't seem to work.
The Lib/uuid.py code looks like this:

        for libname in _libnames:
            try:
                lib = ctypes.CDLL(ctypes.util.find_library(libname))
            except Exception:                           # pragma: nocover
                continue
            # Try to find the safe variety first.
            if hasattr(lib, 'uuid_generate_time_safe'):
		[...]
            elif hasattr(lib, 'uuid_generate_time'):    # pragma: nocover
		[...]

On the target, I have:

# python
Python 3.7.0 (default, Sep 18 2018, 23:23:41) 
[GCC 4.9.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes.util
>>> lib = ctypes.CDLL(ctypes.util.find_library("uuid"))
>>> lib
<CDLL 'None', handle 76f17178 at 0x76b37eb0>
>>> hasattr(lib, 'uuid_generate_time_safe')
False
>>> hasattr(lib, 'uuid_generate_time')
False

Even though libuuid does provide those symbols:

     9: 00001a18     4 FUNC    GLOBAL DEFAULT   10 uuid_generate_time@@UUID_1.0
    56: 00001a1c     4 FUNC    GLOBAL DEFAULT   10 uuid_generate_time_safe@@UUID_2.20

But uuid.uuid1() does work:

# python -c "import uuid; print(uuid.uuid1())"
60fa6f9e-bb8c-11e8-b77b-525400123456

But stracing this process, I don't see the libuuid.so library being
opened, however, I see that Python tries to call gcc and ld, apparently
because that's what ctypes.find_library does
(https://docs.python.org/3/library/ctypes.html#finding-shared-libraries).

So perhaps the pure Python uuid module can do without a working
libuuid. At this point, it's 23:48, and I'm tired, so I stopped the
investigation here.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the buildroot mailing list