Re: [Numpy-discussion] f2py: VS version on Windows
Thanks to all for clearing this up. I have been bouncing this issue off the folks at Intel and they allege that Intel C++ should be able to do this independent of the version of VS used originally (I am skeptical). I am still getting some MKL-related missing symbol errors that we are clearing up and I will post anything useful that I discover. ~Mike C. -Original Message- From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussion-boun...@scipy.org] On Behalf Of David Cournapeau Sent: Monday, February 02, 2009 7:26 PM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] f2py: VS version on Windows On Tue, Feb 3, 2009 at 10:55 AM, Sturla Molden wrote: > >> Python extensions must be built using the same compiler as was used to >> build the Python binary. Python 2.5.4 was built using MSVC2003 and so >> extensions for it must be built using the same compiler. The exception >> to this rule is that extensions built using mingw32 (and msys) will >> work with most, if not all, windows Python binaries. > > > This is NOT correct. Although it is technically true, that's relatively irrelevant for practical matters: it is not currently possible to build numpy with VS 2008 and 7.1 CRT, and you have to build numpy with the same compiler as the one used by python if you use MS compilers. David ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py: VS version on Windows
On Tue, Feb 3, 2009 at 10:55 AM, Sturla Molden wrote: > >> Python extensions must be built using the same compiler as was used to >> build the Python binary. Python 2.5.4 was built using MSVC2003 and so >> extensions for it must be built using the same compiler. The exception >> to this rule is that extensions built using mingw32 (and msys) will >> work with most, if not all, windows Python binaries. > > > This is NOT correct. Although it is technically true, that's relatively irrelevant for practical matters: it is not currently possible to build numpy with VS 2008 and 7.1 CRT, and you have to build numpy with the same compiler as the one used by python if you use MS compilers. David ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py: VS version on Windows
You learn something new every day. It turns out I had previously been given wrong information and I apologize for passing that along to the list. -Patrick On Mon, Feb 2, 2009 at 8:03 PM, Sturla Molden wrote: > >> I'm trying to test out f2py in Windows (python 2.5.4 32-bit >> for now + most recent Numpy). I'd like to use the Intel >> compilers, but msvc is fine if needed. I get the output below >> about which I have a question re: the warning about VS >> version. I have VS 2008 currently which should have no trouble >> making binaries compatible with older version of VS(?) Is >> there any way around this error with VS > 2003? > > Shortly speaking: you must for Python 2.5 link with msvcr71.dll. The > version of the MSVC compiler is unimportant if you can force it to use > this CRT. Check your link libraries, and see if you find one for this DLL. > Otherwise, you need to create a .def file for this DLL and create the link > library from that. And make sure you don't link with other CRT versions. > > S.M. > > > ___ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.org/mailman/listinfo/numpy-discussion > -- Patrick Marsh Graduate Research Assistant School of Meteorology University of Oklahoma http://www.patricktmarsh.com ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py: VS version on Windows
> I'm trying to test out f2py in Windows (python 2.5.4 32-bit > for now + most recent Numpy). I'd like to use the Intel > compilers, but msvc is fine if needed. I get the output below > about which I have a question re: the warning about VS > version. I have VS 2008 currently which should have no trouble > making binaries compatible with older version of VS(?) Is > there any way around this error with VS > 2003? Shortly speaking: you must for Python 2.5 link with msvcr71.dll. The version of the MSVC compiler is unimportant if you can force it to use this CRT. Check your link libraries, and see if you find one for this DLL. Otherwise, you need to create a .def file for this DLL and create the link library from that. And make sure you don't link with other CRT versions. S.M. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py: VS version on Windows
> Python extensions must be built using the same compiler as was used to > build the Python binary. Python 2.5.4 was built using MSVC2003 and so > extensions for it must be built using the same compiler. The exception > to this rule is that extensions built using mingw32 (and msys) will > work with most, if not all, windows Python binaries. This is NOT correct. What you cannot do, is safely share CRT objects between different CRTs. You cannot malloc() some memory with msvcrt.dll, and subsequently free() the memory with msvcr71.dll. Similarly, you cannot fopen() a FILE* with msvcr71.dll and fread() with msvcrt.dll. Applications that do this will sooner or later fail in mysterious ways. Thus to be on the safe side, you should link the same CRT as Python and other native extensions use. That is, msvcr71.dll for Python 2.5. MSVC2003 usually does this by default, but there are exceptions. For example, Visual C++ 2003 Toolkit links against a static version of msvcr71. GCC (mingw) will by default link with msvcrt.dll. It will link with the same CRT as Python if you link with -lmsvcr71. You can create link libraries against this CRT for most compilers, you just need a .def file. Thus, you can use all compilers. If your extension DO NOT share its CRT objects with Python, it does not matter what compiler you use. IANAL, but there is a licensing issue one needs to be aware of: You are not allowed to redistribute msvcr71.dll except if you own a VS2003 license and have used that compiler. This is important if you use py2exe to create a Windows executable. This is one example where GCC cannot be used. But it is a legal issue, not a technical one. On the other hand, I don't think Microsoft has ever percecuted anyone for infringment of their msvcr71.dll copyright. They just want you to develop for their OS. But if you are going to use py2exe, you have to sort this problem out, or simply redistribute a full Python distro instead. In that case, PSF has built Python with a licensed VC2003 compiler, and you are just redustributing their binary installer (which is ok). Sturla Molden ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py: VS version on Windows
Hi Mike, Python extensions must be built using the same compiler as was used to build the Python binary. Python 2.5.4 was built using MSVC2003 and so extensions for it must be built using the same compiler. The exception to this rule is that extensions built using mingw32 (and msys) will work with most, if not all, windows Python binaries. -Patrick On Mon, Feb 2, 2009 at 5:56 PM, Mike Colonno wrote: > I'm trying to test out f2py in Windows (python 2.5.4 32-bit for > now + most recent Numpy). I'd like to use the Intel compilers, but msvc is > fine if needed. I get the output below about which I have a question re: the > warning about VS version. I have VS 2008 currently which should have no > trouble making binaries compatible with older version of VS(?) Is there any > way around this error with VS > 2003? > > > > Thanks, > > ~Mike C. > > > > > > C:\Python25\Lib\site-packages\numpy\f2py\docs>C:\Python25\Scripts\f2py.py -c > --f > > compiler=intel -m hello hello.f > > 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 s > > hould fix me in fcompiler/compaq.py) > > running build > > running config_cc > > unifing config_cc, config, build_clib, build_ext, build commands --compiler > opti > > ons > > running config_fc > > unifing config_fc, config, build_clib, build_ext, build commands --fcompiler > opt > > ions > > running build_src > > building extension "hello" sources > > f2py options: [] > > f2py:> c:\docume~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5\hellomodule.c > > creating c:\docume~1\mike\locals~1\temp\tmptd0t5g > > creating c:\docume~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5 > > Reading fortran codes... > > Reading file 'hello.f' (format:fix,strict) > > Post-processing... > > Block: hello > > Block: foo > > Post-processing (stage 2)... > > Building modules... > > Building module "hello"... > > Constructing wrapper function "foo"... > > foo(a) > > Wrote C/API module "hello" to file > "c:\docume~1\mike\locals~1\temp\tmptd > > 0t5g\src.win32-2.5/hellomodule.c" > > adding > 'c:\docume~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5\fortranobject.c > > ' to sources. > > adding 'c:\docume~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5' to > include_dir > > s. > > copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.c -> > c:\docum > > e~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5 > > copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.h -> > c:\docum > > e~1\mike\locals~1\temp\tmptd0t5g\src.win32-2.5 > > running build_ext > > No module named msvccompiler in numpy.distutils; trying from distutils > > error: 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. > > > > ___ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.org/mailman/listinfo/numpy-discussion > > -- Patrick Marsh Graduate Research Assistant School of Meteorology University of Oklahoma http://www.patricktmarsh.com ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion