Gentoo Archives: gentoo-dev

From: Marien Zwart <marienz@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [PATCH/RFC] eclass/flag-o-matic.eclass: prepend-ldpath
Date: Thu, 11 Oct 2012 21:41:13
Message-Id: CAEWfL_Sr66AE9uKH6jubvJg0Q=bH09fiopkyMiRH85WVcA3URw@mail.gmail.com
In Reply to: Re: [gentoo-dev] Re: [PATCH/RFC] eclass/flag-o-matic.eclass: prepend-ldpath by "Gregory M. Turner"
1 I'm going to do something potentially rude and comment on this without
2 having read the entire thread.
3
4 On Thu, Oct 11, 2012 at 10:39 PM, Gregory M. Turner <gmt@×××××.us> wrote:
5 > Anyhow one thing I have figured out is how things can work correctly on
6 > Linux wihtout -L.: on Linux, the python plugins aren't actually linked
7 > against libpython.so!
8
9 Python can be built with and without a shared library
10 (libpythonx.y.so). If the shared library is built the interpreter
11 executable is linked against it (of course), and normally so are the
12 extension modules. This is useful because it makes the linker do the
13 right thing for applications that embed python (and end up loading
14 libpythonx.y via dlopen). If the shared library is not built extension
15 modules cannot link against it, and the python executable itself
16 exports the relevant symbols. So on a normal shared python build
17 extensions should end up linked against libpythonx.y.so.
18
19 However, at least one popular distro and presumably most of its
20 derivatives (Debian) has a system python built without the shared
21 library, plus the shared library built separately, for use by
22 applications that embed python. I am not entirely sure why they still
23 do this (if I understand correctly it was originally done for
24 performance reasons, but I'm not sure if they've checked those are
25 still valid). Their extension modules cannot link to libpythonx.y:
26 their python interpreter executable provides the same symbols
27 libpythonx.y provides, so loading such an extension module into the
28 regular interpreter would result in collisions.
29
30 The reason I mention this is Gentoo's python is built with the shared
31 library, so on Gentoo your extensions *should* end up linked to
32 libpythonx.y (if they use a more or less standard build system, at
33 least). If yours are not I'm curious what happened, and would
34 appreciate it if you gave me some more information off-list (marienz
35 on freenode or email).
36
37 --
38 Marien Zwart.

Replies

Subject Author
Re: [gentoo-dev] Re: [PATCH/RFC] eclass/flag-o-matic.eclass: prepend-ldpath "Gregory M. Turner" <gmt@×××××.us>