Build Bootloader Win64

xoviat edited this page Jan 1, 2017 · 3 revisions

TODO: Update it for python3 branch, add mingw instructions or move this tutorial to manual.

Building the PyInstaller Bootloaders on Windows x64 with free of charge software

Prerequisites

Windows Build Tools 2015

Windows Build Tools are required to build extensions for Python 3.5 and above. Make sure to select both the Windows 8.1 SDK and the Windows 10 SDK options. Make sure that the version of setuptools that you are using is at least 24.0. In addition, make sure that your vcvarsall.bat file in %PROGRAMFILES(x86)%\Microsoft Visual Studio 14.0\VC contains the following:

rem Vcvarsall for Visual C++ Build Tools 2015
@echo off
set vcprogramfiles=%ProgramFiles(x86)%
if "%vcprogramfiles%"=="" set vcprogramfiles=%ProgramFiles%
call "%vcprogramfiles%\Microsoft Visual C++ Build Tools\vcbuildtools.bat" %*

Visual Studio 2008 Express

One can not build the x64 boot loader with Visual Studio 2008 Express directly, but it still needs to be installed before we can install the x64 compilers from Windows SDK v7.0. Without Studio, the SDK installation fails with the great error message "fatal error". I installed the ISO image from http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso

Windows SDK v7.0

To get the compilers for Windows x64, you need to install a Windows SDK when building with Visual Studio 2008 Express: I used the ISO Image from http://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDKX_EN_DVD.iso which is referenced by this MSDN article: http://www.microsoft.com/en-us/download/details.aspx?id=18950

Python 2.7

To run WAF, we need Python as well. I used the x64 installer from http://www.python.org/ftp/python/2.7.5/python-2.7.5.amd64.msi, installed to c:\python27 (default).

git

For getting the source (and to be able to push back any changes), we need the git scm. Get it from https://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe, install with default options (I enabled the git bash context menu in explorer as well).

Building

Checkout the source

Go to some directory (I used %HOMEPATH%) and open a Git bash there. Checkout pyinstaller with

git clone https://github.com/pyinstaller/pyinstaller.git

Building

To run the build, use the Windows SDK Command Shell. Set the PATH to that the python command can be found:

set PATH=%PATH%;c:\python27

Go to the boot loader source directory:

cd %HOMEPATH%\pyinstaller\bootloader

Now the boot loader can be build by running

python waf configure build install

Testing the build

For running the tests we need to install pywin32 from http://sourceforge.net/projects/pywin32/ (this is what the test runner says when you don't have it). I got mine from http://kent.dl.sourceforge.net/project/pywin32/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe. With that out of the way, the tests can be run using

cd %HOMEPATH%\pyinstaller\tests
python runtests.py -i

This only runs a small part of the tests. To get better coverage, we need to download the Python modules that are used during the tests. The setupenv_windows.py script does that automatically, but it requires setuptools to be installed. To install setuptools it suffices to download the ez_setup.py script from https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py and run it. With the following commands most tests will run (hopefully):

cd %HOMEPATH%\Downloads
python ez_setup.py
cd %HOMEPATH%\pyinstaller\tests
python setupenv_windows.py -d %HOMEPATH%\Downloads