C++ Based OPC UA Client/Server SDK  1.5.5.355
Compiling LibXml2 with Visual Studio

The following sections describe how to compile LibXml2 from source with Visual Studio 2008 and higher.

Requirements

You will need tar to unpack the LibXml2 source package. Download and install Cygwin from https://cygwin.com/install.html. The default installation includes tar.

Debug and Release

The actions described in the following steps may differ depending on the libraries to be compiled for debug or release mode. This will be noted in each step below if applicable.

Furthermore, it is described what files to modify to append a “d” to the filename for debug mode if you inted to use debug and release libraries side by side.

Download and Unpack LibXml2

Download the most recent version of LibXml2 from http://xmlsoft.org/downloads.html. Start a cygwin terminal, navigate to the folder containing the downloaded archive and unpack it:

tar –xvzf libxml2-<version>.tar.gz

Configure

Start the Visual Studio Command Prompt (there’s a shortcut inside the Visual Studio Start Menu entry, the exact name depends on your Visual Studio version), change to the LibXml2 folder extracted in the previous step, then go down into the subfolder win32.

Enter the following commands to create LibXml2 libraries without patent-registered algorithms in release mode:

cscript configure.js compiler=msvc iconv=no debug=no

For debug mode, enter

cscript configure.js compiler=msvc iconv=no debug=yes cruntime=/MDd vcmanifest=yes

Then edit three lines in Makefile.msvc to append a “d” to the filenames:

XML_SO = $(XML_BASENAME)d.dll
XML_IMP = $(XML_BASENAME)d.lib
...
XML_A = $(XML_BASENAME)_ad.lib

Compile

Now we are ready to compile the libraries:

nmake /f Makefile.msvc

Copy the Libraries to the SDK Folder Structure

Finally, it is necessary to copy the library files from bin.msvc to the SDK folder structure. Create a folder named
<SDK Installation Directory>\third-party\win<32/64>\vs<version>\libxml2

A similarly named folder, containing the precompiled LibXml2 binaries shipped with the SDK, should already exist below third-party.

  • Copy the complete include directory to the newly created folder.
  • When using dynamically linked libraries,
    • create a folder named out32dll and place the following files inside it:
      libxml2.dll
      libxml2.lib;
    • create another folder named out32dll.dbg and place the following files inside it:
      libxml2d.dll
      libxml2d.lib
      libxml2d.pdb.
  • When using static libraries,
    • create a folder named out32 containing the file libxml2_a.lib;
    • create a folder named out32.dbg containing the file libxml2_ad.lib.