Skip to content

Set up Build Environment on Windows

Jonathan White edited this page Aug 19, 2024 · 38 revisions

Note: This is only a one-time setup guide. For actually building KeePassXC, please refer to our build guide.

Setup Visual Studio Environment

We recommend building KeePassXC using Visual Studio to maximize feature availability. Visual Studio is free to use and dependencies are provided from trusted sources or self-built using Vcpkg.

Install Visual Studio

  1. Download and install Visual Studio Community 2022: https://visualstudio.microsoft.com/downloads/

  2. At a minimum, ensure the following options are selected. We require at least Windows SDK version 10.0.22000.0. You can also import this installation configuration to auto-select these options: keepassxc_vsconfig.zip

image

  1. (Optional) Instead of the entire IDE, you may install Visual Studio Build Tools and use VSCode as an IDE.

Install vcpkg

Since release 2.7.7, KeePassXC uses vcpkg's manifest option. This greatly simplifies dependency management, but you need to install vcpkg first to use the capability. Once vcpkg is installed then you simply build KeePassXC to have all appropriate dependencies built for you. Note the first build may take up to several hours to complete due to Qt5.

  1. Download and install vcpkg: https://vcpkg.io/en/getting-started.html

  2. Be sure to follow every step including bootstrapping vcpkg

  3. Periodically, you should update vcpkg repository by opening a command prompt, going to vcpkg folder, and executing git pull. This will download the latest ports and require a rebuild of the cache the next time you build KeePassXC.

Install Asciidoctor

  1. Download and install Ruby without devkit: https://rubyinstaller.org/downloads/

    a. Make sure to uncheck install MSYS2/MINGW on the final install screen.

  2. Open a command prompt and run: gem install asciidoctor

  3. In the same command prompt, test the install by running: asciidoctor

(DEPRECATED) Setup MSYS Environment

Building using MSYS is deprecated, we no longer recommend this method.

Install the build environment

  • Download MSYS2 64bit: http://msys2.github.io/
  • Start MSYS2 shell
  • Update the system packages: pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
  • Restart MSYS2 shell
  • Update all packages: pacman -Syu
    If prompted, restart the shell and re-run this command until done

Install the C++ toolchain

This command will install the MinGW-W GCC compiler, CMake, Binutils, and Asciidoctor:

Open an MSYS2 shell:

pacman -S git make mingw-w64-$(uname -m)-gcc mingw-w64-$(uname -m)-toolchain \
    mingw-w64-$(uname -m)-binutils mingw-w64-$(uname -m)-cmake \
    mingw-w64-$(uname -m)-asciidoctor

Install the required dependencies

Open an MSYS2 shell:

pacman -S mingw-w64-$(uname -m)-qt5 \
    mingw-w64-$(uname -m)-libbotan mingw-w64-$(uname -m)-zlib \
    mingw-w64-$(uname -m)-argon2 mingw-w64-$(uname -m)-qrencode

Packaging Requirements

To build an installation package when running make package you need to have the WiX toolset installed. You can obtain it from https://github.com/wixtoolset/wix3/releases

Once installed you will need to add the toolset folder to your MSYS PATH environment: export PATH="${PATH}:/c/Program Files (x86)/WiX Toolset v3.11/bin"

Update your environment regularly

Open a MSYS2 shell:

pacman -Syu