[Tutor] tadaahh! But how to identify zLinux?

eryksun eryksun at gmail.com
Tue Apr 2 04:57:16 CEST 2013


On Mon, Apr 1, 2013 at 6:42 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> By the way, I don't know that changing directory is a good idea, if you can
> avoid it at all.

As far as loading linked libraries goes, changing the current
directory works on Windows, and I think OS X, but it doesn't work on
Linux. On Windows you can also add the directory to the system PATH at
run time.

I see 3 deb files in spssio/lin32. It doesn't seem like your plan is
to install these since you don't have them for lin64 as well. Is this
savReaderWriter supposed to be a self-contained system for
reading/writing IBM SPSS files, or dependent on an existing
installation of SPSS? (Not being a user of SPSS, I have no idea how
foolish that question may or may not sound. Oh well.)

Anyway, I downloaded and extracted the deb files to a temp directory
on a 32-bit Debian system. In addition to the libs that you've already
extracted, ldd determined that I also needed the following libs:

libimf.so          [intel-icc8-libs_8.0-1_i386.deb]
libcxaguard.so.5   [intel-icc8-libs_8.0-1_i386.deb
libstdc++.so.5.0.7 [libstdc++5_3.3.6-20_i386.deb]

and links for the ELF soname fields:

libstdc++.so.5    ->  libstdc++.so.5.0.7
libicudata.so.32  ->  libicudata.so.32.0
libicui18n.so.32  ->  libicui18n.so.32.0
libicuuc.so.32    ->  libicuuc.so.32.0

After setting up the above, I patched a runpath of $ORIGIN into
libspssdio.so.1. This instructs the loader to look for dependencies in
the same directory.

    $ patchelf --set-rpath '$ORIGIN' libspssdio.so.1

Now I can load the library with ctypes:

    >>> from ctypes import *
    >>> spssio = CDLL('spssio/lin32/libspssdio.so.1')
    >>> spssio.spssOpenRead
    <_FuncPtr object at 0xb753b094>


More information about the Tutor mailing list