jameskermode / f90wrap

F90 to Python interface generator with derived type support
GNU Lesser General Public License v3.0
239 stars 78 forks source link

Error in windows 7 64 bit and intel fortran. #62

Open NMC-DAVE opened 7 years ago

NMC-DAVE commented 7 years ago

Hi, I try to use f90wrap with windows7 64bit, intel fortran and anaconda2(python2.7), but failed. The fortran file is example.f90 under the examples\interface directory. So, why? very thanks!

G:\Source\Python\collections\f90wrap\f90wrap-master\examples\interface>python "C :\Anaconda2\Scripts\f90wrap" -v -m example example.f90 Kind map (also saved to .f2py_f2cmap) {}

Constructors: ('initialise_ptr', 'initialise', 'allocate')

Destructors: ('finalise', 'deallocate')

Short names for derived types: {}

String lengths: {}

Initialisation lines for derived types {}

Python module name remapping {} Class names remapping {}

Argument name map: {}

Size of Fortran derived type pointers is 2 bytes.

Parsing Fortran source files ['example.f90'] ... DEBUG:root:processing file example.f90 INFO:root:marking module class_example as default private DEBUG:root: interface return_example INFO:root:parser reading type Example DEBUG:root: type Example DEBUG:root: module function checking return_example_first DEBUG:root: implicit type of "return_example_first" inferred from its nam e as "real" DEBUG:root: module function return_example_first DEBUG:root: module function checking return_example_second DEBUG:root: implicit type of "return_example_second" inferred from its na me as "real" DEBUG:root: module function return_example_second DEBUG:root: module function checking return_example_third DEBUG:root: implicit type of "return_example_third" inferred from its nam e as "real" DEBUG:root: module function return_example_third DEBUG:root: module class_example done parsing source.

DEBUG:root:type example defined in module class_example Derived types detected in Fortran source files: {'example': Type(name=example), 'type(example)': Type(name=example)}

Class name mapping: {'example': 'Example', 'type(example)': 'Example'} Modules for each type: {'class_example': 'class_example'} Traceback (most recent call last): File "c:\anaconda2\lib\site-packages\f90wrap-0.1.4-py2.7-win-amd64.egg\EGG-INF O\scripts\f90wrap", line 298, in main remove_optional_arguments) TypeError: transform_to_generic_wrapper() takes exactly 12 arguments (14 given) f90wrap: TypeError('transform_to_generic_wrapper() takes exactly 12 arguments (1 4 given)',) for help use --help Traceback (most recent call last): File "C:\Anaconda2\Scripts\f90wrap", line 4, in import('pkg_resources').run_script('f90wrap==0.1.4', 'f90wrap') File "C:\Anaconda2\lib\site-packages\pkg_resources__init.py", line 738, in run_script self.require(requires)[0].run_script(script_name, ns) File "C:\Anaconda2\lib\site-packages\pkg_resources\init__.py", line 1499, in run_script exec(code, namespace, namespace) File "c:\anaconda2\lib\site-packages\f90wrap-0.1.4-py2.7-win-amd64.egg\EGG-INF O\scripts\f90wrap", line 341, in sys.exit(main()) File "c:\anaconda2\lib\site-packages\f90wrap-0.1.4-py2.7-win-amd64.egg\EGG-INF O\scripts\f90wrap", line 298, in main remove_optional_arguments) TypeError: transform_to_generic_wrapper() takes exactly 12 arguments (14 given)

nenanth commented 6 years ago

Hi @NMC-DAVE, can you give me some guidance on what your setup on windows is?

I'm trying to get f90wrap working on windows 10 with mingw-w64 and Python 2.7, and running into an installation issue when setting up f90wrap. I donwloaded the repository, and tried

python setup.py install

and ran into a multiple definition error

F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-atonexit.o):atonexit.c:(.text+0xc0): multiple definition of atexit' F:\Programs\Python\libs/libmsvcr90.a(deoks01081.o):(.text+0x0): first defined here F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o):mingw_helpers.c:(.text+0x0): multiple definition of_decode_pointer' F:\Programs\Python\libs/libmsvcr90.a(deoks00231.o):(.text+0x0): first defined here F:/Programs/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-mingw_helpers.o):mingw_helpers.c:(.text+0x10): multiple definition of `_encode_pointer' F:\Programs\Python\libs/libmsvcr90.a(deoks00241.o):(.text+0x0): first defined here collect2.exe: error: ld returned 1 exit status error: Command "gcc -g -shared build\temp.win-amd64-2.7\Release\f90wrap\arraydatamodule.o build\temp.win-amd64-2.7\Release\programs\python\lib\site-packages\numpy\f2py\src\fortranobject.o -LF:\Programs\Python\libs -LF:\Programs\Python\PCbuild\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\f90wrap\arraydata.pyd" failed with exit status 1

If you can point me towards your exact combination of software versions, it would be a great help!

cheers Ananth

jameskermode commented 6 years ago

I don't have access to a Windows setup to test on unfortunately, but let me know if you get to the bottom of this and if any changes to f90wrap need to be made.

nenanth commented 6 years ago

@NMC-DAVE I solved the transform_to_generic_wrapper issue.. you have to set the paths correctly. @jameskermode do you have insight on SIGINT issue ? Thread: https://github.com/jameskermode/f90wrap/issues/73 https://msdn.microsoft.com/en-us/library/xdkz3x12.aspx

nenanth commented 6 years ago

@jameskermode: I think #include may be required in XYZmodule.c. (XYZ = python module name) - that may fix the SIGINT issue. If you could help point to where to include the header file (not clear to me from a scan of f2py2e.py), I could try it out