[Numpy-discussion] Re: gcc-4.1

Darren Dale dd55 at cornell.edu
Sat Mar 18 12:08:01 CST 2006


On Monday 13 March 2006 9:05 pm, Robert Kern wrote:
> Darren Dale wrote:
> > Has anyone been able to build numpy with gcc-4.1? I upgraded gcc on my
> > home computer this weekend from glibc-2.3.6 and gcc-3.4.5 to glibc-2.4
> > and gcc-4.1. When I try to build numpy I get warnings like "warning:
> > build_ext: fcompiler=gnu is not available." I tried forcing numpy to use
> > gfortran with "python setup.py config_fc --fcompiler=gnu95 build", and
> > got the same warning for fcompiler=gnu95.
>
> Building numpy shouldn't require any kind of Fortran compiler.
>
> However, the problem is that the version-recognizing regex doesn't like the
> version string "GNU Fortran 95 (GCC) 4.1.0 (Gentoo 4.1.0)". Look in
> numpy/distutils/fcompiler/gnu.py and the class attribute
> Gnu95FCompiler.version_pattern .

Thanks Robert. May I suggest the following change, from:
version_pattern = r'GNU Fortran 95 \(GCC (?P<version>[^\s*\)]+)'
to:
version_pattern = r'GNU Fortran 95 \(GCC?\) (?P<version>[^\s*\)]+)'
along with the following comment to go with the debian example:
# Gentoo: GNU Fortran 95 (GCC) 4.1.0 (Gentoo 4.1.0)

Also, I wonder if I found a bug in numpy/distutils/ccompiler.py.

    if status in ok_status:
        m = re.match(self.version_pattern,output)
        if m:
            version = m.group('version')
            if not m:
                raise ValueError("compiler version not matched (%r)" %\ 
(version,))
            version = LooseVersion(version)
    self.version = version
    return version

That ValueError will never be raised, since it has already been established 
that m is not NoneType.

Darren




More information about the Numpy-discussion mailing list