[SciPy-user] build problem using cygwin - solved

Geza Groma groma at nucleus.szbk.u-szeged.hu
Fri May 17 07:05:53 EDT 2002


Well, it took a while to trace back the problem... The root of that is analyzed in
 http://www.nanotech.wisc.edu/~khan/software/gnu-win32/mno-cygwin-howto.txt.
In a nutshell, the -mno-cygwin compiler flag (set by distutil in Python2.2) should ensure a
mingw-type linking,
but several mingw libraries (libgcc.a, libg2c.a, libiberty.a, libm.a, libobjc.a and
libstdc++.a) are not distributed in a standard cygwin package. In the case of scipy the
improper (cygwin-type) libg2c.a is linked to a dll. The solution is to copy the above
libraries from a mingw distribution to the /usr/lib/mingw directory. In my setup (gcc
2.95.3-5)  this is mounted to c:\cygwin\lib\mingw (_not_ to c:\cygwin\usr\lib\mingw!) In
this version the specs already knows this location, as well as that up the minw header files
which are distributed correctly.

The next problem is that the scipy distutils explicitly sets a -L flag pointing the original
path, so even if the correct libraries are in the correct place the wrong ones will be
linked. This is manage in the following peace of code in
scipy\scipy_distutils\command\build_flib.py:

class gnu_fortran_compiler(fortran_compiler_base):

    vendor = 'Gnu'
    #ver_match = r'g77 version (?P<version>[^\s*]*)'
    ver_match = r'GNU Fortran (?P<version>[^\s*]*)'

    def __init__(self, fc = None, f90c = None):
        fortran_compiler_base.__init__(self)
        if sys.platform == 'win32':
            self.libraries = ['gcc','g2c']
            self.library_dirs = self.find_lib_directories()
        else:
            # On linux g77 does not need lib_directories to be specified.
            self.libraries = ['g2c']
[snip]

The solution is to comment out the line
            self.library_dirs = self.find_lib_directories()
Also 'gcc' is not needed in self.libraries, that is gcc 2.95.3-5 on windows behaves
identical to that in linux.
I suggest to put an extra condition on 'win32' platform checking the the version of gcc
(probably not that of g77).
I have no idea that from what version the above mechanism works, but for me it helped to
build scipy completely.

Geza Groma

Pearu Peterson wrote:

> On Tue, 14 May 2002, Geza Groma wrote:
>
> > I tried to build scipy from the latest (MAy 13) CVS on a WindowsNT using
> > cygwin-1.3.10-1 and gcc-2.95.3-5.
> > It succesfully built atlas.3.3.15 and created the complete liblapack.a
> > library from LAPACK 3.0. Building of scipy, however,  is stopped at the
> > creation of the first dll with the error message below.
> >
> > Any idea what is wrong?
>
> No. But google seems to contain lots of messages reporting similar
> problems with cygwin. They may be helpful.
>
> > c:\cygwin\bin\gcc.exe -mno-cygwin -mdll -static -s
>                                      ^^^^^^^^^^ - ?
> > build\temp.win32-2.2\Release\fortranobject.o build\temp.win32-2.2\Rel
> > ease\fblasmodule.o build\temp.win32-2.2\Release\fblas.def -LC:\Atlaslib
> > -LC:\Atlaslib -Lbuild\temp.win32-2.2 -LC:\Python
> > 22\libs -Lbuild\temp.win32-2.2
> > -Lc:/cygwin/lib/gcc-lib/i686-pc-cygwin/2.95.3-5 -lfblas -llapack
> > -lf77blas -lcblas -latla
> > s -lpython22 -lc_misc -lcephes -lrootfind -lgcc -lg2c -o
> > build\lib.win32-2.2\scipy\linalg\fblas.pyd
> > c:/cygwin/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/libg2c.a(s_stop.o)(.text+0x2f):s_stop.c:
> > undefined reference to `_impure_ptr'
> <snip>
>
> Pearu
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at codetent.com
> http://www.scipy.net/mailman/listinfo/scipy-user

--
Géza Groma
Institute of Biophysics,
Biological Research Center of Hungarian Academy of Sciences
Temesvári krt.62.
6726 Szeged
Hungary
phone: +36 62 432 232
fax:   +36 62 433 133





More information about the SciPy-User mailing list