[SciPy-user] weave and mingw on win xp sp2 bug?

mani sabri mani.sabri@gmail....
Mon Dec 31 03:08:47 CST 2007

I just installed mingw in c:\mingw and moved my python24 from "c:\program
files\python24" to "c:\python24" and added those environment variables that
I mentioned before and every thing did not worked!(such as weave.test() and
some of most of examples but its not important because imho they are
outdated) but my code compiled successfully. 

>-----Original Message-----
>From: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] On
>Behalf Of Michael ODonnell
>Sent: Monday, December 31, 2007 2:31 AM
>To: SciPy Users List
>Subject: Re: [SciPy-user] weave and mingw on win xp sp2 bug?
>I also changed the location of my temp directory in the
>environment variables to C:/Temp. I have learned that everything tends to
>work best when there are no spaces in directories and ISO standards are
>Like I mentioned I was only able to get weave.inline to work with python
>2.5.1 and mingw 5.0.3. I tried python 2.4.1 and 2.4.4 with visual studio
>compilers and mingw. 
>OS: Windows XP SP2 professional
>Processor: x86
>I suggest you check that MinGW is installed correctly by following the
>directions on their website. A summary of these directions include: First
>install MSYS, say, to directory C:\msys\1.0. Then install MinGW to
>C:\msys\1.0\mingw directory. If you choose to install MinGW to C:\mingw as
>the installer suggests by default then you have to create a file
>C:\msys\1.0\etc\fstab containing c:/mingw /mingw and then restart your
>computer so that /mingw will be mounted. Once this is done you might test
>the compiler on something to eliminate this as a source of error. Then make
>sure you add the MinGW path to PYTHONPATH environment variable (e.g., %
>PYTHONPATH%; C:\msys\1.0\bin;C:\msys\1.0\mingw\bin;).
>I then had to modify the numpy distutils exec_command.py. This is likely
>found in C:\Python25\Lib\site-packages\numpy\ distutils:
>                    I commented out this code starting on line 67 or so:
>    '''
>    if os.name in ['nt','dos']:
>        fdir,fn = os.path.split(pythonexe)
>        fn = fn.upper().replace('PYTHONW','PYTHON')
>        pythonexe = os.path.join(fdir,fn)
>        assert os.path.isfile(pythonexe), '%r is not a file' % (pythonexe,)
>    '''
>        And then I replaced with these lines:
>        ###MOD edits
>        #C:\Python24\python.exe
>        import string
>        exe = 'python.exe'
>        for p in string.split(os.environ['Path'],';'):
>            fn = os.path.join(os.path.abspath(p),exe)
>            if os.path.isfile(fn):
>                pythonexe = fn
>        ###End of MOD edits
>These edits worked for me.
	It's strange. 

>I was never successful in using VS2003 toolkit or VS2005 Express. I was
>able to install these and compile some python modules successfully so they
>did work as compilers. However, changes to the SDK had to be implemented in
>order for these to work as well. I am not sure why I could not get weave to
>work with these compilers but once I got something to work I gave up trying
>to understand due to my time constraints. The alterations I made to the
>compilers are included below. Apparently the problem has to do with
>Microsoft and Express. The full software package of visual studio
>apparently does not have these problems. Here are the edits I made to get
>these to compile python modules (weave still did not work however).
>Source for this info: http://www.codeproject.com/KB/wtl/WTLExpress.aspx
>1. cd C:\Program Files\Microsoft Platform SDK\include\atl
>Change SetChainEntry function at line 1725 of atlwin.h - define "int i" at
>the first line of the function body.
>BOOL SetChainEntry(DWORD dwChainID, CMessageMap* pObject, DWORD
>dwMsgMapID = 0)
>    int i;
>    // first search for an existing entry
>    for(i = 0; i < m_aChainEntry.GetSize(); i++)
>2.Change AllocStdCallThunk and FreeStdCallThunk at line 287 of atlbase.h to
>the new macros
>/* Comment it
>PVOID __stdcall __AllocStdCallThunk(VOID);
>VOID __stdcall __FreeStdCallThunk(PVOID);
>#define AllocStdCallThunk() __AllocStdCallThunk()
>#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
>#pragma comment(lib, "atlthunk.lib")
>#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),
>                              0, sizeof(_stdcallthunk))
>#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
>3. Download and install WTL from SourceForge
>cd  to WTL\AppWiz folder, double click setup80x.js (or appropriate version
>to install the WTL Wizard into VC Express

More information about the SciPy-user mailing list