[Numpy-discussion] Re: Cygwin compilation

Jochen Küpper jochen at jochen-kuepper.de
Tue Sep 30 01:46:03 CDT 2003

On 29 Sep 2003 17:05:09 -0400 Todd Miller wrote:

>> _ufunc.dll needs to be linked against /usr/lib/libmingwex.a. Doing
>> that manually seems to work fine.

Todd> In the file generate.py, a clause for sys.platform == "cygwin?"
Todd> probably needs to be added. Then, define EXTRA_LINK_ARGS for
Todd> cygwin.

Ok, did that.
,----[cvs diff -u generate.py]
| Warning: No xauth data; using fake authentication data for X11 forwarding.
| Index: generate.py
| ===================================================================
| RCS file: /cvsroot/numpy/numarray/generate.py,v
| retrieving revision 1.14
| diff -u -u -r1.14 generate.py
| --- generate.py 16 Sep 2003 20:02:41 -0000      1.14
| +++ generate.py 30 Sep 2003 08:33:38 -0000
| @@ -51,6 +51,9 @@
|      LP64, HAS_UINT64, HAS_FLOAT128 = 0, 1, 0
|  elif sys.platform == "win32":
|      LP64, HAS_UINT64, HAS_FLOAT128 = 0, 0, 0
| +elif sys.platform == "cygwin":
| +    LP64, HAS_UINT64, HAS_FLOAT128 = 0, 0, 0
| +    EXTRA_LINK_ARGS += ["-L/lib/mingw -lmingwex"]
|  elif sys.platform == "darwin":
|      LP64, HAS_UINT64, HAS_FLOAT128 = 0, 1, 0
|      EXTRA_COMPILE_ARGS.extend(["-Ddarwin"])

Should work, but I get the following strange behavior:
| > python setup.py build
| running build
| running build_py
| copying Lib/numinclude.py -> build/lib.cygwin-1.5.5-i686-2.3/numarray
| running build_ext
| building 'numarray._ufunc' extension
| gcc -shared -Wl,--enable-auto-image-base -march=pentium3 -mcpu=pentium4 -O2 -Wall -pipe build/temp.cygwin-1.5.5-i686-2.3/Src/_ufuncmodule.o -L/usr/lib/python2.3/config -lpython2.3 -o build/lib.cygwin-1.5.5-i686-2.3/numarray/_ufunc.dll -L/lib/mingw -lmingwex
| build/temp.cygwin-1.5.5-i686-2.3/Src/_ufuncmodule.o(.text+0x14f): In function `_CheckFPErrors':
| /home/software/programming/numeric/numarray/Src/_ufuncmodule.c:136: undefined reference to `_fetestexcept'
| build/temp.cygwin-1.5.5-i686-2.3/Src/_ufuncmodule.o(.text+0x17b):/home/software/programming/numeric/numarray/Src/_ufuncmodule.c:142: undefined reference to `_feclearexcept'
| collect2: ld returned 1 exit status
| error: command 'gcc' failed with exit status 1
| > gcc -shared -Wl,--enable-auto-image-base -march=pentium3 -mcpu=pentium4 -O2 -Wall -pipe build/temp.cygwin-1.5.5-i686-2.3/Src/_ufuncmodule.o -L/usr/lib/python2.3/config -lpython2.3 -o build/lib.cygwin-1.5.5-i686-2.3/numarray/_ufunc.dll -L/lib/mingw -lmingwex

That is, it does not work when called from setup.py. When I just copy
'n' paste the link statement to the command-line, it just works.(#$%)

Any ideas??

>> Is it save to use this mingw library in "normal" Cygwin programs?

Todd> I don't know. I didn't get any farther than this, perhaps not as
Todd> far. I got the impression that mingw was a minimal library
Todd> intended for porting gcc (but it has IEEE stuff), while the
Todd> cygwin libc is intended for real programs (but has no IEEE stuff
Todd> because it is a lightweight knock off of glibc used to bypass
Todd> the GPL).

Well, as I see it Cygwin is a Unix emulation layer for Windows,
whereas MINGW is a port of gcc and some other GNU tools to Windows
(not using Cygwin at all).

But looking around using it this way should be ok. Maybe someone who
knows cygwin better can speak up here? I would carbon-copy this email
to the cygwin list, but that is subscribers only nowadays:(

>> Moreover I have the follwoing test error:
>> ,----
>> | Failure in example: log10([1+1j])
>> | from line #2267 of numarray.numtest
>> | Expected: array([ 0.150515+0.34109409j])
>> | Got: array([ 0.150515+5.21807245j])
>> `----

Todd> One of our guys found a bug in the complex log10 function; both
Todd> the expected result and the implementation were changed.

Seems to be resolved.

Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
        (Part 3 you find in my messages before fall 2003.)

More information about the Numpy-discussion mailing list