[f2py] Basic question (fwd) (KASSBOHM)

Pavanakumar Mohanamuraly <[email protected]> Mon, 20 Aug 2012 18:51:47 +0530
Newsgroups gmane.comp.python.f2py.user
Message-ID <CAAS9=SX0m_ZmLcna_UxD0c5zX4NP6FFzQkjdLKGPS1PyPTqYJg@mail.gmail.com>
Sven,

> Hello,
>
> I am new to f2py. So: Sorry for my stupid question in advance.
>
> I am building an xxx.so file locally with f2py from my Fortran-source like
> this:
>
> f2py -c -m xxx -L/opt/.../lib/ -l... xxx.f
>
> Then I can do:
>
> import xxx
>
> in my Python program. Everything works fine. That is: On my local box with
> Intel-Compiler.
>
> But actually: I would like to use this xxx.so on other boxes than mine as well.
> In fact, this is the most important reason for me to use f2py. I assume, that I
> do not need to have an Intel-Compiler installed everywhere...
>
> When I try to import my xxx.so on a box without Intel, I get (since
> libifport.so.5 is an Intel-Object) the error message:
>
> ImportError: libifport.so.5: cannot open shared object file: No such f...
>
> But isn't the thrilling thing about f2py, that one can COMPLETELY WRAP a
> Fortran subroutine and use it with Python?
>
> What is it, I most definitely need to understand, before I go any step
> further...
>
> Can you help?


I dont think you can link against shared library when your target
system does not have the necessary shared libs installed. You must do
a static build or package the necessary shared libs with your
binaries. Moreover, for the binaries to be portable you need to have a
similar machine i.e, similar linux kernel and arch of processor.  You
can always put multiple arch support (cross platform builds) on the
same binaries. Some OS like Mac-OSX supports both 32 and 64 bit builds
on the same binary, otherwise you have to make binaries for chosen
arch (and kernel ver) and choose the appropriate ones using a shell
script wrapper.

I dont know the command-line option in Intel compiler for static
builds. You can either google for it or check in the compiler manual.

> Sven
>

Regards,

-- 
Pavanakumar Mohanamuraly