Re: [f2py] Compiling/linking the Fortran source files manually
Ben Forbes <[email protected]> Tue, 26 Apr 2011 16:31:49 +1000
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
When I try that I get an error: numpy.distutils.fcompiler.CompilerNotFound On Tue, Apr 26, 2011 at 4:07 PM, Pearu Peterson <[email protected]> wrote: > > > On 04/26/2011 06:09 AM, Ben Forbes wrote: >> On Mon, Apr 25, 2011 at 5:34 PM, Ben Forbes<[email protected]> wrote: >>> I'm having trouble getting f2py (from Enthought 7.0.2 64-bit) to play >>> nicely with my compiler (Intel Visual Fortran 11 build 067). I am >>> running Windows 7 64-bit. My source file is just a hello world >>> subroutine, and I am running "f2py -c helloworld.f90". >> >> I've made some progress on this: >> - I use "f2py helloworld.f90" to get helloworldmodule.c. >> - I copy over fortranobject.c and fortranobject.h. >> - I manually compile the C files using mingw 64-bit to get .o files. > > Btw, have you tried > > f2py -c -m foo helloworld.f90 --compiler=mingw32 --fcompiler=intelem > > Pearu > >> - I manually compile helloworld.f90 to .obj. >> - Now I to use lib.exe (from Visual C) to link everything together. >> - I rename the resultant .lib to helloworld.pyd. >> >> The problem I'm currently getting is that when I try to "import >> helloworld", it tells me: >> >> ImportError: DLL load failed: %1 is not a valid Win32 application. >> >> It appears I need a DLL with an entry point. How would I achieve this? >> >> Here are my commands for reference: >> >> C:\MinGW_64\bin\x86_64-w64-mingw32-gcc.exe -g -DDEBUG -DMS_WIN64 >> -mno-cygwin -O0 -Wall -Wstrict-prototypes >> -IC:\Python27\lib\site-packages\numpy\core\include >> -IC:\Python27\include -IC:\Python27\PC -c fortranobject.c -o >> fortranobject.o >> >> C:\MinGW_64\bin\x86_64-w64-mingw32-gcc.exe -g -DDEBUG -DMS_WIN64 >> -mno-cygwin -O0 -Wall -Wstrict-prototypes >> -IC:\Python27\lib\site-packages\numpy\core\include >> -IC:\Python27\include -IC:\Python27\PC -c helloworldmodule.c -o >> helloworldmodule.o >> >> "C:\Program Files (x86)\Intel\Compiler\11.1\067\bin\intel64\ifort.exe" >> /MT /c helloworld.f90 >> >> "C:\Program Files (x86)\Microsoft Visual Studio >> 9.0\VC\Bin\x86_amd64\lib.exe" fortranobject.o helloworldmodule.o >> helloworld.obj c:\Python27\libs\python27.lib /LIBPATH:"C:\Program >> Files (x86)\Intel\Compiler\11.1\067\lib\ia32" /LIBPATH:"C:\Program >> Files (x86)\Microsoft Visual Studio 9.0\VC\Lib" /LIBPATH:"C:\Program >> Files (x86)\Microsoft Visual Studio 9.0\VC\PlatformSDK\Lib" >> >> >> >>> The first >>> apparent errors are when ifort is called: >>> >>> ifort: command line warning #10006: ignoring unknown option '/shared' >>> ifort: command line warning #10006: ignoring unknown option '/shared' >>> ifort: command line warning #10161: unrecognized source type >>> 'c:\users\bdforbes\appdata\local\temp\tmpu >>> pntzq\Release\users\bdforbes\appdata\local\temp\tmpupntzq\src.win-amd64-2.7\untitledmodule.o'; >>> object f >>> ile assumed >>> ifort: command line warning #10161: unrecognized source type >>> 'c:\users\bdforbes\appdata\local\temp\tmpu >>> pntzq\Release\users\bdforbes\appdata\local\temp\tmpupntzq\src.win-amd64-2.7\fortranobject.o'; >>> object fi >>> le assumed >>> ifort: command line warning #10161: unrecognized source type >>> 'c:\users\bdforbes\appdata\local\temp\tmpu >>> pntzq\Release\helloworld.o'; object file assumed >>> ifort: command line warning #10006: ignoring unknown option '/LC:\Python27\libs' >>> ifort: command line warning #10006: ignoring unknown option >>> '/LC:\Python27\PCbuild\amd64' >>> ifort: command line warning #10006: ignoring unknown option '/lpython27' >>> ifort: command line warning #10006: ignoring unknown option '/OU' >>> ifort: command line warning #10006: ignoring unknown option '/OT' >>> ifort: command line warning #10155: ignoring option '/optimize'; >>> argument required >>> ifort: command line warning #10006: ignoring unknown option '/O.' >>> ifort: command line warning #10006: ignoring unknown option '/O\' >>> ifort: command line warning #10006: ignoring unknown option '/Ou' >>> ifort: command line warning #10006: ignoring unknown option '/On' >>> ifort: command line warning #10006: ignoring unknown option '/Ol' >>> ifort: command line warning #10006: ignoring unknown option '/Oe' >>> ifort: command line warning #10006: ignoring unknown option '/O.' >>> ifort: command line remark #10010: option '/Op' is deprecated and will >>> be removed in a future release. >>> See '/help deprecated' >>> >>> Is it possible for me to provide f2py with a pre-compiled object file >>> or static library? I know how to produce .obj and .lib, not sure how >>> to turn those into .o or .a or .so. >>> >>> Thanks for your help. >>> >>> >>> -- >>> Benjamin D. Forbes >>> School of Physics >>> The University of Melbourne >>> Parkville, VIC 3010, Australia >>> >> >> >> > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > -- Benjamin D. Forbes School of Physics The University of Melbourne Parkville, VIC 3010, Australia