[Numpy-discussion] Re: gcc-4.1

David M. Cooke cookedm at physics.mcmaster.ca
Sat Mar 18 14:48:02 CST 2006

Darren Dale <dd55 at cornell.edu> writes:

> 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)

I fixed that a few days ago and forgot to check my solution in :-)
Now, you can define a version_match method that can do more complex
matching, instead of just a regex. The GNU Fortran compilers now use
this: gfortran, for instance, checks the version output to start
with 'GNU Fortran 95', then something versionish (the regex [-.\d]+).

> 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.

This is fixed too.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the Numpy-discussion mailing list