All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [autobuild.buildroot.net] Your build results for 2018-08-30
Date: Tue, 18 Sep 2018 23:49:23 +0200	[thread overview]
Message-ID: <20180918234923.5dbb7abe@windsurf> (raw)
In-Reply-To: <a9927d39-0d18-8d49-7ac6-07ac9dfb4daa@mind.be>

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@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

      parent reply	other threads:[~2018-09-18 21:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180831060016.342FF22A3A@mail.bootlin.com>
2018-09-02 19:57 ` [Buildroot] [autobuild.buildroot.net] Your build results for 2018-08-30 Carlos Santos
2018-09-03 15:29   ` Matthew Weber
2018-09-03 19:49     ` Matthew Weber
2018-09-04  9:45       ` Thomas Petazzoni
2018-09-04 22:43         ` Arnout Vandecappelle
2018-09-05  6:49           ` Thomas Petazzoni
2018-09-18 21:49           ` Thomas Petazzoni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180918234923.5dbb7abe@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.