Subject: Cygwin Python 2.1, Numeric package, exporting init<module> methods
From: "Mark Hadfield" <[email-masked]>
To: "Cygwin Mailing List" <[email-masked]>
Cc: "Robert Yodlowski" <[email-masked]>
Date: Mon, 30 Apr 2001 10:44:49 +1200

Hello all

I have modified Python's Numeric module library so that it can be built on
Cygwin Python 2.1. I want to have the master distribution modified so it
works OOTB. Obviously this is a matter for the Numeric maintainers but I
would like some advice on Cygwin matters (exports & such) before I take it
to them.

To summarise, I installed Python 2.1 for Cygwin using Cygwin setup. The
Python executable reports the following:

    Python 2.1 (#1, Apr 17 2001, 09:45:01)
    [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01

I then downloaded Numeric-20.0b2 from here

    http://prdownloads.sourceforge.net/numpy/Numeric-20.0.0b2.tar.gz

unpacked it & attempted to build it using the setup script, i.e. I ran

    python setup.py build

I got errors from the linker

    Cannot export _bss_end__: symbol not defined
    Cannot export _bss_start__: symbol not defined
    Cannot export _data_end__: symbol not defined
    Cannot export _data_start__: symbol not defined

I took this problem to comp.lang.python and got a reply from Robert
Yodlowski who said:

> make this (macro call) line
>
> DL_EXPORT(void)
>
> the "return value" of each of the init<somemodulename> routines (1 in each
> file) in
>
> lapack_litemodule
> arrayfnsmodule
> ranlibmodule
> multiarraymodule
> umathmodule
> _numpymodule
> _kindsmodule
> fftpackmodule
> RNGmodule

I made the suggested change to all the above & it worked. Thanks Robert!

Robert also mentioned a message from Jason Tishler to the Cygwin mailing
list on the subject. I presume it was this one:

    http://sources.redhat.com/ml/cygwin/2000-11/msg00526.html

It refers to 2 methods of getting the necessary exports, the DL_EXPORT macro
and .def files.

As I said above, would like to have Numeric Python working on Cygwin Python
OOTB. I'm not sure that it's reasonable to ask the maintainers to add the
DL_EXPORT macro to all module init functions, so I guess the .def files are
the way to go. But they don't seem to be working. For example Numeric Python
*does* have a .def file for lapack_lite. It's in the Src subdirectory
alongside lapack_litemodule.c, it's called lapack_lite.def, it's in Unix
text format (if that matters) and it contains:

    EXPORTS
        initlapack_lite

As far as I can see it is set up correctly, but if I omit the DL_EXPORT
macro, the linking fails. Perhaps this is not surprising as I do not see a
reference to the .def file anywhere in the compiler or linker command lines.

This looks like a Distutils problem. Is there a --compiler option that
handles things properly? (I tried --compiler=cygwin but the Distutils
documentation suggests that this is intended for building extensions to
win32 Python and it does not find the Python library.)

Doubtless other people are way ahead of me on this one & I would appreciate
all & any advice.

---
Mark Hadfield
[email-masked]  http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple