ANSI C Based OPC UA Client/Server/PubSub SDK
Compiling the SDK and Examples with MinGW


First of all, it is very important that the SDK is installed to a path that doesn’t contain any spaces. Otherwise, it won’t build successfully.

The tools needed to compile the SDK with MinGW (including the third-party libraries) can be obtained via MSYS2. Download MSYS2 from and install and update it as described here.

Then install the following packages with MSYS2’s package manager (replace “x86_64” with “i686” for a 32 bit toolchain):

pacman -S base-devel tar mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake

In addition, you have to install the reqired third-party libraries.

The CMake installation package contains the cmake-gui as well, but it requires Qt5 with an installed size of about 4 GB. Thus, the following instructions use CMake from the command line. If installing Qt5 doesn’t bother you and you prefer a GUI, install the following package (respectively the 32 bit variant):

pacman -S mingw-w64-x86_64-qt5

Create Makefiles for the SDK

Start a MinGW-w64 Win64 (or Win32 respectively) and change to the folder which contains the SDK. Create a subfolder named “mingw_bld” and change to this directory:

mkdir mingw_bld
cd mingw_bld

Now we’re using CMake to generate MSYS Makefiles. It is necessary to set the option CMAKE_INSTALL_PREFIX to a path that doesn’t contain spaces (the default value does) and to specify where the sources are (the directory “src” inside the SDK installation directory).

cmake -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=../dist ../src

Finally, we can build the SDK:

make install

Create Makefiles for the Examples

Creating makefiles for the examples is quite similar as described above for the SDK. Create a new folder below “sdk”, e.g. named “mingw_bldexamples”, and change to the folder:

mkdir mingw_bldexamples
cd mingw_bldexamples

When creating makefiles with CMake, it is necessary to set CMAKE_INSTALL_PREFIX to the same path as specified above. The sources for the examples are in the subfolder “examples” of the SDK installation directory.

cmake -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=../dist ../examples

Now we can build and install the examples:

make install

When finished, the binaries can be found in the subfolder “bin” of the folder specified at “CMAKE_INSTALL_PREFIX” (see screenshot).