building a linux executable

Carl Banks pavlovevidence at gmail.com
Wed Oct 24 21:03:55 EDT 2007


On Oct 24, 5:08 pm, Prateek <sure... at gmail.com> wrote:
> On Oct 24, 5:25 pm, Paul Boddie <p... at boddie.org.uk> wrote:
>
> > On 24 Okt, 14:20, Bjoern Schliessmann <usenet-
>
> > mail-0306.20.chr0n... at spamgourmet.com> wrote:
>
> > > I'm sorry I cannot help, but how many linux distros have no python
> > > installed or no packages of it?
>
> > It's not usually the absence of Python that's the problem. What if
> > your application uses various extension modules which in turn rely on
> > various libraries (of the .so or .a kind)? It may be more convenient
> > to bundle all these libraries instead of working out the package
> > dependencies for all the target distributions, even if you know them
> > all.
>
> > Paul
>
> Thanks Paul,
>
> So I've bundled all the extension modules (cx_Freeze helped me out
> with that). Here is what I did:
>
> if sys.platform.startswith("linux"):
>     import [add a bunch of imports here]
>
> This import statement immediately imports all modules which will be
> required. Hence, cx_Freeze is easily able to find them and I can put
> all the .so files with the distro.
>
> The problem is that some of these .so files (_hashlib.so) are hard-
> linked to /lib/libssl.so and /lib/libcrypto.so. I cannot simply just
> copy those (libssl/libcrypto) files into the distribution folder (and
> cx_Freeze won't do anything about them because they are not Python
> modules). I need a way to figure out how to get _hashlib.so to refer
> to a libssl.so which is in the same directory (I would have thunk that
> it should use the PATH environment variable - apparently not).


The environment variable you want is LD_LIBRARY_PATH.

Also, if you're not aware, the ldd command can print out the library
dependencies.


> This seems to be a simple enough problem, doesn't it??
>
> NB: Has the community come up with a better way to distribute Python
> executables on linux? I'd also like to hear from folks who've got
> linux distributables of medium to large scale python programs...

Since most Linux systems have Python installed these days, the impetus
isn't quite as strong, even given the issues brought up here.


Carl Banks




More information about the Python-list mailing list