Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure python cffi library to use mingw?

Attempting to call cffi.FFI.verify() on windows will produce this error:

distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat

I want to use mingw to compile instead of msvc. I tried to make distutils use mingw by creating c:\Python27\Lib\distutils\distutils.cfg with

[build]
compiler = mingw32

but this doesn't seem to affect cffi, I still get vcvarsall.bat missing error.

So how can I make cffi use gcc/mingw (or in general other C compiler)?

like image 596
vanem Avatar asked May 28 '13 08:05

vanem


1 Answers

Try to reinstall cffi, now that distutils is properly configured. For example using easy_install

easy_install cffi

Or even rebuild & install it from source using MinGW that way :

cd cffi-src-dir
python setup.py config --compiler=mingw32 build --compiler=mingw32 install
cd ..

This will make sure that cffi is correctly setup for use with MinGW... I guess...

like image 177
Gauthier Boaglio Avatar answered Nov 08 '22 19:11

Gauthier Boaglio