Building yangcli-gw on Windows

Windows 11 build guide for yangcli-gw using MSYS2

Prerequisites Windows

Install MSYS2

MSYS2 is a software distribution and development platform for Windows. It provides a Unix-like environment and a package management system based on pacman, making it easy to install and maintain development tools and libraries.

  • MSYS2 supports multiple environments, including the native MSYS shell and the MinGW-w64 shells (32-bit and 64-bit), which are crucial for compiling native Windows applications like yangcli-gw.

  • The 'UCRT64' and 'MINGW64' environments are supported.

Download and install from: https://www.msys2.org/

Update MSYS2

pacman -Syu   # follow instructions and restart terminal if prompted

Install build tools and dependencies

The library names shown are for the 'MINGW64' environment.

  • base-devel: Essential tools for building software (make, autoconf, etc.)

  • mingw-w64-x86_64-toolchain: GCC compiler suite for Windows (C/C++)

    • Select 'default' to install all components

  • mingw-w64-x86_64-libxml2: XML parsing library

  • mingw-w64-x86_64-libssh2: SSH client library

  • mingw-w64-x86_64-openssl: TLS/SSL encryption support

  • mingw-w64-x86_64-zlib: Compression library

  • mingw-w64-x86_64-xz: LZMA compression support

  • mingw-w64-x86_64-iconv: Character encoding conversion

  • mingw-w64-x86_64-gettext: Internationalization (i18n) library

  • mingw-w64-x86_64-cppzmq: C++ ZeroMQ messaging library

  • mingw-w64-x86_64-libsodium: Cryptographic library for encryption/signatures

  • mingw-w64-x86_64-libtre: Approximate regex pattern matching

  • mingw-w64-x86_64-gcc: GNU compiler

  • mingw-w64-x86_64-libsystre: System wrapper library for libtre

  • mingw-w64-x86_64-zeromq: ZeroMQ messaging library

  • mingw-w64-x86_64-libcbor: YANG to CBOR support library

Command for 'MINGW64' environment:

pacman -S base-devel git mingw-w64-x86_64-toolchain \
          mingw-w64-x86_64-libxml2 \
          mingw-w64-x86_64-libssh2 \
          mingw-w64-x86_64-openssl \
          mingw-w64-x86_64-zlib \
          mingw-w64-x86_64-xz \
          mingw-w64-x86_64-iconv \
          mingw-w64-x86_64-gettext \
          mingw-w64-x86_64-cppzmq \
          mingw-w64-x86_64-libsodium \
          mingw-w64-x86_64-libtre \
          mingw-w64-x86_64-gcc \
          mingw-w64-x86_64-libsystre \
          mingw-w64-x86_64-zeromq \
          mingw-w64-x86_64-libcbor \
          make

Command for 'UCRT64' environment:

pacman -S base-devel git mingw-w64-ucrt-x86_64-toolchain \
      mingw-w64-ucrt-x86_64-libxml2 \
      mingw-w64-ucrt-x86_64-libssh2 \
      mingw-w64-ucrt-x86_64-openssl \
      mingw-w64-ucrt-x86_64-zlib \
      mingw-w64-ucrt-x86_64-xz \
      mingw-w64-ucrt-x86_64-iconv \
      mingw-w64-ucrt-x86_64-gettext \
      mingw-w64-ucrt-x86_64-cppzmq \
      mingw-w64-ucrt-x86_64-libsodium \
      mingw-w64-ucrt-x86_64-libtre \
      mingw-w64-ucrt-x86_64-gcc \
      mingw-w64-ucrt-x86_64-libsystre \
      mingw-w64-ucrt-x86_64-zeromq \
      mingw-w64-ucrt-x86_64-libcbor \
      make

Open the proper environment shell

Launch MSYS2 MinGW or UCRT 64-bit shell, not the default MSYS shell.

Build Steps

First change directory to the top directory of the source code tree.

For example the path C:\mysource\yumapro would be located in path /c/mysource/yumapro.

Run make with the custom makefile

You can run the build using the provided makefile. The build system uses the MINGW64_ROOT variable to locate the MinGW toolchain. By default, it assumes MSYS2 is installed in C:/msys64, so MINGW64_ROOT defaults to:

/c/msys64/mingw64

In most cases, no override is needed:

make -f win-yangcli-gw.make

However, if your MSYS2 installation is located elsewhere, override the path like this:

make -f win-yangcli-gw.make MINGW64_ROOT=/d/DevEnv/msys2/mingw64

Example: Using 'UCRT64' installed in the UCRT64 environment in the /ucrt64 directory

make -f win-yangcli-gw.make MINGW64_ROOT=/ucrt64

Output

After a successful build, the binary and copied YANG modules will be located here:

netconf/target/yangcli-gw/windows/yangcli-gw.exe

Notes

After building, you can test the binary with the following steps:

cd netconf/target/yangcli-gw/windows/
./yangcli-gw.exe

Example running with default parameters:

C:\dev\ypwork\netconf\target\yangcli-gw\windows\yangcli-gw.exe version 21.10-win-THD (24.6.0-T)

libssh2 version 1.11.1

Copyright (c) 2008-2012, Andy Bierman, All Rights Reserved.
Copyright (c) 2012-2025, YumaWorks, Inc., All Rights Reserved.

zmqapi: Bind to responder endpoint OK 'tcp://127.0.0.1:5555'
zmqapi: Bind to publisher endpoint OK 'tcp://127.0.0.1:5556'

For usage instructions and configuration examples after building, please refer to the Getting Started guide.

Note

If you want yangcli-gw to locate YANG modules automatically, copy them to your home directory under the .yumapro/modules folder. Alternatively, you can specify a custom path using the --modpath parameter when running the binary.