Join GitHub today
Creating a 64 bit development environment with MinGW on Windows
DEPRECATED: Kivy wheels using mingwpy are available since 1.9.1. It is recommended that https://binstar.org/carlkl/mingwpy be used instead of generic MinGW.
In order to use kivy in true 64 bit mode you'll first need to set up your environment
to be able to build 64 bit binaries. For this you'll need the 64 bit mingw. We'll
assume that you already installed a 64 bit Python into e.g.
Download the mingw 64 binaries (e.g. x86_64-4.8.2-release-win32-sjlj-rt_v3-rev0.7z) from e.g. the personal builds at http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.2/threads-win32/sjlj/. Now extract the zip file into
C:\dev-64. Rename the top level directory, if it's not already, to
mingw64. You should now have the following directory structure:
C:\dev-64\mingw64\bin C:\dev-64\mingw64\include C:\dev-64\mingw64\mingw ...
You'll need gendef. Download and extract gendef.exe into
mingw64/binfrom http://sourceforge.net/projects/mingw/files/MinGW/Extension/gendef/gendef-1.0.1346/. Keep in mind that this is a 32 bit binary.
At this point it's helpful to use the kivy.bat file and to edit the python paths to point to the proper Python27 location and to add the mingw64bin directory to the system path. In any case, for the following to work you either have to provide the full path to gendef and dlltool or add
mingw64\binto the system path.
C:\windows\system32copy the file
C:\dev-64\Python27\libs. Now type the following as described here http://bugs.python.org/issue4709:
cd C:\dev-64\Python27\libs rename python27.lib old_python27.lib gendef python27.dll dlltool --dllname python27.dll --def python27.def --output-lib libpython27.a
Now we'll patch the
C:\Python27\include\pyconfig.hfile. In that file search for the text
#ifdef _WIN64, which in our copy of this file was at line 141, and cut out the following three lines:
#ifdef _WIN64 #define MS_WIN64 #endif
Search for the text
#ifdef _MSC_VER, which in our copy of this file was at line 107. Paste in the cut-out lines, ABOVE the
Finally, we need to patch the cygwin compiler in distutils as described here http://bugs.python.org/issue16472. Open
C:\dev-64\Python27\Lib\distutils\cygwinccompiler.pyand comment out the line that says
self.dll_libraries = get_msvcr(). In our file it's line 343. Be carefull because there's another similar line that does not need to be commented out.
You should now have a working 64 bit mingw installation and are ready to continue at step 2
of Using Kivy with an existing Python installation on Windows (64 or 32 bit). Just remember in step 3 to add
mingw64\bin to the path instead of