[f2py] gfortran with static and shared libs
KASSBOHM <[email protected]> Fri, 31 Aug 2012 16:14:15 +0300 (EEST)
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <alpine.DEB.2.02.1208311549400.28515@thnkpd> |
I have so Fortran sources, I would like to use from Python. I would like to link my objects with: lib1: a STATIC lib (3rd party) libs2: SHARED libs of gfortran lib3: another STATIC lib (3rd party) More precisely, I would like to search all those libs in that order. That is, for example: If there is a symbol or function in libs2 AND in lib3, I would like to use that of libs2. But there are symbols in lib3, which I need. Can I do such things with f2py? If yes: How? Can anybody help? I tried the following: ***A*** If I do: f2py ... -llib1 -lib3, I get: /usr/bin/gfortran -Wall -Wall -shared ...xxxmodule.o .../fortranobject.o obj.o obj.o ...-Lpath -llib1 -lib3 -lgfortran -o ./xxx.so /usr/bin/ld: path/lib3.a(stop.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC path/lib3.a: could not read symbols: Bad value ***B*** If I do: f2py ... -llib1, I get, when importing the module: ImportError: ./xxx.so: undefined symbol: _gfortran_copy_string Sure, I did not link lib3. That's why gfortran_copy_string is missing. It's seems not to be included in libs2. But 3rd party says: It is included in lib3.