[Wheel-builders] [Matplotlib-devel] Manylinux external library test case - matplotlib, tk

Nathaniel Smith njs at pobox.com
Tue May 10 18:38:59 EDT 2016


On Tue, May 10, 2016 at 3:09 PM, Leonardo Rochael Almeida
<leorochael at gmail.com> wrote:
> On 10 May 2016 at 18:52, Matthew Brett <matthew.brett at gmail.com> wrote:
>>
>> On Tue, May 10, 2016 at 5:26 PM, Matthew Brett <matthew.brett at gmail.com>
>> wrote:
>> >> [...]
>> >>
>> >> This would probably look like:
>> >>
>> >> _tkagg.so has a DT_NEEDED entry naming tkinter.so (or whatever Python
>> >> calls
>> >> this module)
>> >>
>> >> Before loading _tkagg.so, we use Python level introspection figure out
>> >> where
>> >> tkinter.so lives
>> >>
>> >> We add its directory to LD_LIBRARY_PATH
>> >>
>> >> we import _tkagg.so
>> >>
>> >> We take its directory back off of LD_LIBRARY_PATH
>> >>
>> >> Very weird, but I can't see why it wouldn't work, and probably more
>> >> reliable
>> >> than anything where we try to reimplement the dynamic loader's search
>> >> logic
>> >> ourselves.
>> >
>> > Nice - yes - it does work in a first-pass test - I'll look into
>> > automating that.
>>
>> Ah - except I do not believe it is possible to change the linker path
>> for Python modules, within the Python process:
>>
>> http://www.gossamer-threads.com/lists/python/python/393770#393770

Doh :-(

> I was about to point that out...
>
> On the other hand, if there is a `Tkinter` module that Python can import,
> just importing it will make the symbols needed the `_tkagg` module
> available, assuming Python calls `dlopen()` on import with RTLD_GLOBAL[1].
>
> [1] http://man7.org/linux/man-pages/man3/dlopen.3.html
>

But it doesn't use RTLD_GLOBAL. You can make it with
sys.setdlopenflags, but this then dumps a bunch of symbols into
*every* Python extension module's namespace, which is pretty risky...

-n

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


More information about the Wheel-builders mailing list