[f2py] Problem compiling with F2PY using intel Fortran 64-bit compiler on OS X 10.6

Ravi Kanda <[email protected]> Fri, 11 Feb 2011 17:22:42 +0800
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
  Hi,

I have been using F2PY for over 2 years now, primarily on Linux 
(32-bit).  I recently moved my python computations to a MacPro 
workstation (12-core, Intel Mac, 64-bit, with OS X 10.6.6; Python 2.6.1, 
Numpy 2.0.0.dev-799179d).  Just to be safe, I am doing some basic tests 
(compilers, speed, etc) before moving on to compiling more complex f90 
modules. I am able to compile the default test fortran scripts 
(Fib1_Quick, Fib1_Smart: from the F2PY website) without any problems 
using gfortran (4.2.1). However, with the intel 64-bit compiler, IFORT, 
I get a "Library not loaded ... Image not found" error message in the 
Python interpreter when I try to import the shared library 'fib1.so' 
created using f2py.  I want to use the Intel compiler for optimized 
performance of my f90 codes (I found f2py/intel-compiled codes to be 
much faster when working on Linux).  The source, wrap-script, and 
diagnostics are in the attached ZIP file.

----------------------------
INTEL COMPILER ISSUE DETAILS:
----------------------------
I installed intel's 64-bit Fortran compiler (ifort 12.0.0 20101006 for 
OS X) in INTEL_ROOT='/opt/intel'.  My $PATH contains $INTEL_ROOT/bin & 
$LD_LIBRARY_PATH contains $INTEL_ROOT/lib.  I can compile native f90 
programs from the Terminal.  Also, I store all my '*.so' libraries 
under: $USER_ROOT/dv/products/modules, which is in $PYTHONPATH.  When I 
compile Fib1_Quick example using the ifort compiler, I find that 
'fib1.so' is generated in the current working directory, and copied to 
the above modules directory as well (see attached wrap script and 
logfile) - and this works for the gfortran generated 'fib1.so' library.  
I also don't see any error/warning messages during the wrapping process 
(see logfile).  Now, when I try to import the intel 'fib1' from the 
python interpreter, I obtain the following error message:
---------------------------------------------------
 >>> import fib1
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/rkanda/dv/products/modules/fib1.so, 2): 
Library not loaded: libifport.dylib
   Referenced from: /Users/rkanda/dv/products/modules/fib1.so
   Reason: image not found
---------------------------------------------------

'libifport.dylib' does exist under $INTEL_ROOT/lib, and hence, visible 
via my $LD_LIBRARY_PATH.  I tried using f2py with and without the 
'-L$LIB_DIR' as well as '-l$lib1 -l$lib2 ...' options but each time, I 
get an identical error message in the python interpreter that the 
library was not found.   Looking online, I found suggestions for using 
'otool' on the library to determine its dependencies.  This output is 
also included in the attachment.  However, from the 'otool' log, I can't 
figure out where python is looking for the '*.dylib' files.  In 
desparation, I created soft links to the intel libraries in the above 
modules directory, which is in my $PTYTHONPATH, as well as in the system 
Python site-packages (where I instal all my public and private Python 
packages).  That does not work either.

I am probably doing something really stupid, but at a loss as to what.  
I will really appreciate any suggestions/ideas.

Thanks in advance.

Regards,
Ravi Kanda.
------------------

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users
fib1_quick_intel_f2py_wrap.zip (application/zip, 2.9 KB) - not displayed