[f2py] using f2py to wrap c code
Robert Von Dreele <vondreel-Bt58TgthqyNYTrM/[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I was trying to use f2py to wrap c code with the "Hello World" example. I am using MinGW compilers (i.e. not MSVC). I obtain the following:
C:\pyGSASII\testing>f2py -c hello.pyf hello.c
running build
running scons
customize MSVCCompiler
Found executable C:\gfortran\bin\cl.exe
Ignoring "Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py." (one should fix me in fcompiler/compaq.py)
customize GnuFCompiler
Found executable C:\MinGW\bin\g77.exe
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
Found executable C:\MinGW\bin\g77.exe
customize GnuFCompiler
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize MSVCCompiler
Missing compiler_cxx fix for MSVCCompiler
customize MSVCCompiler using scons
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
building extension "hello" sources
creating c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm
creating c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5
f2py options: []
f2py: hello.pyf
Reading fortran codes...
Reading file 'hello.pyf' (format:free)
Post-processing...
Block: hello
Block: sayhi
Post-processing (stage 2)...
Building modules...
Building module "hello"...
Constructing wrapper function "sayhi"...
retval = sayhi()
Wrote C/API module "hello" to file "c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5/hellomodule.c"
adding 'c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5\fortranobject.c' to sources.
adding 'c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5' to include_dirs.
copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5
copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\docume~1\bvondr~1\locals~1\temp\tmp48_tcm\src.win32-2.5
running build_ext
customize MSVCCompiler
customize MSVCCompiler using build_ext
building 'hello' extension
compiling C sources
Traceback (most recent call last):
File "C:\Python25\Scripts\f2py.py", line 24, in <module>
main()
File "C:\Python25\lib\site-packages\numpy\f2py\f2py2e.py", line 560, in main
run_compile()
File "C:\Python25\lib\site-packages\numpy\f2py\f2py2e.py", line 547, in run_compile
setup(ext_modules = [ext])
File "C:\Python25\lib\site-packages\numpy\distutils\core.py", line 184, in setup
return old_setup(**new_attr)
File "C:\Python25\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python25\lib\distutils\dist.py", line 974, in run_commands
self.run_command(cmd)
File "C:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\Python25\lib\site-packages\numpy\distutils\command\build.py", line 40, in run
old_build.run(self)
File "C:\Python25\lib\distutils\command\build.py", line 112, in run
self.run_command(cmd_name)
File "C:\Python25\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\Python25\lib\site-packages\numpy\distutils\command\build_ext.py", line 218, in run
self.build_extensions()
File "C:\Python25\lib\distutils\command\build_ext.py", line 416, in build_extensions
self.build_extension(ext)
File "C:\Python25\lib\site-packages\numpy\distutils\command\build_ext.py", line 312, in build_extension
**kws)
TypeError: compile() got an unexpected keyword argument 'depends'
NB: C:\gfortran\bin\cl.exe in the 5th line is a dummy file I must provide to get f2py to do fortran code in this environment (i.e. no MSVC compiler).
The traceback shows the error in build_ext.py where kws is a dictionary with 'depends' as its only member which is set a few lines above the failure.
Any advice is welcome.
Bob Von Dreele