Skip to content

Build on Windows

The module from source in MSYS2, with the versions of the packages that CI builds with.

  1. Download and install MSYS2.
  2. Press the Windows button and launch MSYS2 MINGW64.
  3. Update packages: pacman -Syu and confirm at prompts.
  4. Relaunch MSYS2 (if necessary) and install dependencies:

    pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-unbound mingw-w64-x86_64-protobuf git gettext base-devel wget
    
  5. Clone repo: git clone --recurse-submodules https://github.com/libmonero/monero-python.git

  6. Install the packages at the versions that CI uses (ICU, hidapi and libusb, boost, pybind11, and OpenSSL with the packages that link to it). bin/msys2_pins.txt has them with their sha256, and the script downloads, checks and installs a group of them:

    cd monero-python
    for group in icu hidapi-libusb boost pybind11 openssl; do bin/install_msys2_pins.sh $group; done
    

    hidapi and libusb were removed from the msys2 mingw64 repo, the script installs the archived packages. OpenSSL is at 3.6.5 because the net_ssl.cpp of monero-project does not build with OpenSSL 4, and the packages that link to it go back with it (unbound, ldns, curl, libarchive, hiredis, libssh2 and ngtcp2): the ones of the repo are rebuilt against OpenSSL 4. CI also pins the MinGW toolchain (bin/install_msys2_pins.sh toolchain), see build-windows.yml.

  7. Build monero-cpp, located as a submodule at ./external/monero-cpp:

    cd external/monero-cpp
    ./bin/build_libmonero_cpp.sh
    cd ../..
    
  8. Build monero-python:

    mkdir -p build &&
    cd build &&
    cmake ..
    cmake --build .
    
  9. Or run build script: ./bin/build_libmonero_python.sh