Skip to content

Instructions for building on Windows

SamJakob edited this page Dec 15, 2022 · 3 revisions

The following are instructions for building Scyther on a Windows host.

To cross-compile Windows from a *nix host (i.e., macOS or Linux), install the dependency referred to in the README and then simply run the following:
cd ./src; ./subbuild-unix-w32.sh

Building Scyther on Windows

  1. Download and install MSYS2 for Windows (this provides a UNIX-like environment for building on Windows).

  2. Install the MINGW64 cross-compiler (this is different to the ucrt version specified in the instructions, and additionally the make program for UNIX makefiles and the cmake build system by running the following in the MSYS2 terminal:
    pacman -S mingw-w64-cross-toolchain make cmake

    (if this step becomes outdated, you could just follow the instructions on the MSYS2 setup page, modify src/BuildUnix-Win32.cmake and then subsequently install make and cmake however this will enable parity with the instructions for building the Windows binary on Ubuntu - if unclear, simply follow this step as-is).

  3. Add the /opt/bin to the PATH environment variable by adding the command to do so to ~/.bashrc (execute the following command in the MSYS2 window): echo "PATH=\"/opt/bin:$PATH\"" >> ~/.bash_profile

    You can then reload your ~/.bash_profile with the following:
    . ~/.bash_profile

  4. Clone the repository. You can do so with: pacman -S git (to install Git)
    git clone https://github.com/cascremers/scyther

  5. Install the necessary dependencies (Python 3, GNU Flex and GNU Bison - both tools for creating and implementing programming language grammars), and run the pre-requisite script (to set version information). pacman -S python3 flex bison
    ./describe-version.py (if you get an error fatal: No names found, cannot describe anything., you must first create a tag, e.g., git tag v1.2)

  6. Run the build by performing ./subbuild-unix-w32.sh

Troubleshooting

  • If you get the error 'Don't know how to build for Win32', and above this message you see 'Could not find Build-Win32.cmake' run the following command:
    cp BuildUnix-Win32.cmake Build-Win32.cmake
    (here, the source platform and the destination platform are recognized as Win32 - rather than the source platform being Unix which means it expects a file called Build-Win32.cmake even under MSYS2, to solve the problem we just copy the file so that it has the expected name as that build script will work under MSYS2).
Clone this wiki locally