[Wheel-builders] Packaging a library that uses PyGObject?

Nathaniel Smith njs at pobox.com
Sun Feb 23 20:57:27 EST 2020


On Sun, Feb 23, 2020 at 5:27 PM Geoffrey Thomas <geofft at ldpreload.com> wrote:
> (For bonus points, call g_irepository_prepend_search_path() / see if
> PyGObject has some binding to it, instead of setting $GI_TYPELIB_PATH, and
> use ctypes to load the actual C library using RTLD_GLOBAL so that it's
> already loaded when PyGObject goes looking for it, instead of setting
> $LD_LIBRARY_PATH.)

IIRC, $LD_LIBRARY_PATH is only consulted once at process startup, and
changing it after that doesn't affect the current process at all. So I
think the ctypes trick would actually be mandatory. But, it doesn't
matter whether you use RTLD_GLOBAL or RTLD_LOCAL, because the loader's
soname->dso cache is always process-global, even if the dso's are
supposed to be local. (Nothing about ELF scoping is intuitive.) So you
should probably use RTLD_LOCAL to reduce the chance of unwanted
side-effects.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Wheel-builders mailing list