Hello,

I'm trying to do a simple test with f2py, using the Hermite polynomial
example here: http://www.scipy.org/Cookbook/F2Py
I cannot figure out how to configure the compile/build commands to work
with my system. I'm a novice at this stuff, so please bear with me...

I'm running on Mac OS X, and since the Xcode compiler does not include
fortran, I have the version 4.4 of gcc installed from MacPorts. So my
compilers should be /opt/local/bin/gcc-mp-4.4 and gfortran-mp-4.4, and the
associated lib/include directories are also under /opt. I've used this to
compile other fortran programs so I am confident it is installed correctly.

Now, I downloaded that hermite polynomial code, and the first command (f2py
-m hermite -h hermite.pyf hermite.f) runs fine. I'm stuck on the second
command that is supposed to compile the code and create the .so file. The
keyword arguments to f2py (-f90exec, -compiler) don't seem to help but it
appears to read shell variables, so the farthest I could get was to do the
following:

CC=/opt/local/bin/gcc-mp-4.4 F90=/opt/local/bin/gfortran-mp-4.4 f2py
--verbose -c hermite.pyf hermite.f

In verbose mode it prints out the contents of the distutils objects, and it
looks like it is getting the correct compiler paths, but things are still
garbled because certain things appear to still reference the Xcode compiler
- here is a piece of the distutils content printed by f2py:

********************************************************************************
distutils.unixccompiler.UnixCCompiler
linker_exe    = ['/opt/local/bin/gcc-mp-4.4']
compiler_so   = ['/opt/local/bin/gcc-mp-4.4', '-fno-strict-aliasing',
'-fno-common', '-dynamic', '-arch', 'i386', '-isysroot',
'/Developer/SDKs/MacOSX10.5.sdk', '-DNDEBUG', '-g', '-O3', '-arch', 'i386',
'-isysroot', '/Developer/SDKs/MacOSX10.5.sdk']


So it has the correct path to the MacPorts gcc but then the flags are not
correct since those refer to Xcode; it causes a stop error because
gcc-mp-4.4 has no -arch flag. My guess is that I have to figure out how to
change those flags - which probably means modifying the distutils calls
somehow. Has anyone dealt this issue before, and maybe has some pointers on
where to look? It is not clear to me how any of the f2py command line flags
will modify these things, and I don't see how to setup my own
'UnixCCompiler' object that has the correct flags.


Thanks,
Aronne
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to