[I18n-sig] iconv codec

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 10 Jan 2001 22:45:16 +0100


> FYI: I've modified setup.py in the following way to build the
> iconv codec with an old libc5 and libiconv.  Two iconv libraries
> are statically linked so that iconvmodule.so can be imported
> without relying on the LD_LIBRARY_PATH environment variable.
> The prefix /opt/libiconv-1.5.1 should be changed appropriately.

Is that a standard location as provided by some Linux distributor? If
so, we could check whether some specific files are there, and then
automatically add them as extra objects.

If you can find a patch (e.g. using os.path.exists) that detects your
configuration (and perhaps the default /usr/local installation), feel
free to check that into the CVS.

As for linking statically vs dynamically: If you give the extension a
runtime_library_dirs attribute, the resulting extension will find its
shared libraries in these directories; this is achieved through the -R
linker option. Of course, if the shared library is in /usr/local/lib,
it'll be found anyway.

> I could not figure out a way to achieve the same things without
> modifying the setup.py script (possible?).

I believe using the build_ext command's options --link-objects,
--libraries, --library-dirs, and --rpath might help, so

python setup.py build_ext -I/opt/libiconv-1.5.1/include -L/opt/libiconv-1.5.1/lib -R/opt/libiconv-1.5.1/lib -liconv -lcharset

should have worked. I get an exception that something is a string that
shouldn't; if you run into the same problem, you may report it as a
distutils bug.

Regards,
Martin