py-scipy: numpy vs. gcc problem (solved)

Jochen Küpper jochen at fhi-berlin.mpg.de
Sun Apr 15 06:29:52 PDT 2007


On 14.04.2007, at 09:39, Jochen Küpper wrote:

> I am trying to install py-scipy using MacPorts, but always end up  
> with the errors listed below.
>
> I have the following gcc-ports installed:
>   gcc41                          lang/gcc41     4.1.2        The  
> GNU compiler collection
>   gcc42                          lang/gcc42     4.2-20070307 The  
> GNU compiler collection, prerelease BETA

Ok, the real problem seems to be an incompatibility between numpy and  
gcc42:

In numpy/distutils/fcompiler/gnu.py a string match is done against  
the output of `gfortran --version`:

class GnuF95Compiler(FCompiler):
     compiler_type = 'gnu'
     version_match = simple_version_match(start=r'GNU Fortran 95')

but `gfortran-dp-4.2 --version` gives "GNU Fortran (GCC) 4.2.0  
20070307 (prerelease)" (thus: no "95"!)


Using the following patch to numpy fixes the problem for me and I can  
successfully compile and use py-scipy on Intel then.
However, the real fix might be to correct the gfortran version output.


--- /opt/local/lib/python2.4/site-packages/numpy/distutils/fcompiler/ 
gnu.py~    2007-04-15 14:00:26.000000000 +0200
+++ /opt/local/lib/python2.4/site-packages/numpy/distutils/fcompiler/ 
gnu.py     2007-04-15 14:16:32.000000000 +0200
@@ -13,7 +13,7 @@
class GnuFCompiler(FCompiler):
      compiler_type = 'gnu'
-    version_match = simple_version_match(start=r'GNU Fortran (?!95)')
+    version_match = simple_version_match(start=r'GNU Fortran')
      # 'g77 --version' results
      # SunOS: GNU Fortran (GCC 3.2) 3.2 20020814 (release)
@@ -240,7 +240,7 @@
class Gnu95FCompiler(GnuFCompiler):
      compiler_type = 'gnu95'
-    version_match = simple_version_match(start='GNU Fortran 95')
+    version_match = simple_version_match(start='GNU Fortran')
      # 'gfortran --version' results:
      # Debian: GNU Fortran 95 (GCC 4.0.3 20051023 (prerelease)  
(Debian 4.0.2-3))


Greetings,
Jochen
-- 
Fritz-Haber-Institut der MPG -- Department of Molecular Physics
Faradayweg 4-6 (C1.03)
D-14195 Berlin, Germany

phone: +49-30-84135686
fax:   +49-30-84135892


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.macosforge.org/pipermail/macports-users/attachments/20070415/1414a0f3/PGP.bin


More information about the macports-users mailing list