3rd_xml2

libxml2 3rd party

libxml2 was used in ViSP 3.2.0 or older releases to parse xml files. After ViSP 3.2.0 we replace libxml2 with pugixml 3rd party library that is embedded in ViSP, meaning that it is no more nead to install libxml2.

libxml2 is the XML C parser library licensed under the terms of the MIT license. libxml2 official home page is http://xmlsoft.org. libxml2 is one of the optional 3rd parties supported by ViSP core module. libxml2 may be also useful in vision and mbt modules.

In ViSP libxml2 is used to handle camera parameters (thanks to vpXmlParserCamera class) and in the model-based tracker to load configuration parameters (see vpMbTracker class).

Hereafter we provide installation instructions for the following OS:

 logo-ubuntu-alpha  logo-debian logo-fedora logo-redhat centos-logo  logo-apple-alpha  logo-win-alpha
Ubuntu Debian Fedora RedHat CentOS OSX Windows

Ubuntu or debian installation

On Linux Debian or Ubuntu, you may install the package with:

sudo apt-get install libxml2-dev

Fedora, RedHat or CentOS installation

On Fedora, RedHat or CentOS you may install the package with yum:

su -c "yum install libxml2-devel"

Mac OSX installation

On OSX you may install the package with homebrew:

brew install libxml2

Windows installation

Under Windows we suggest to build libxml2 from source code.

The download page http://xmlsoft.org/downloads.html gives access to an ftp server ftp://xmlsoft.org/libxml2 from where you can download the latest source code release.

Download the tarball corresponding to the latest version: libxml2-2.9.7.tar.gz and unzip this archive in C:\workspace

Now to build libxml2 library, open either a x86 or a x64 Visual Studio Native Tools Command Prompt. Your choice depends on the Visual C++ compiler selected during ViSP configuration with CMake tool. If your intention is to use “Visual Studio <version> Win64” use an x64 Visual Studio Native Tools Command Prompt. If you select rather  “Visual Studio <version>” use an x86 Command Prompt.

To open the Visual Studio Command Prompt window: If you have Visual Studio 2005 or later installed on your computer, click Start, point to All Programs, point to Microsoft Visual Studio, point to Visual Studio Tools, and then click Visual Studio Command Prompt for native x86 or x64 depending on your computer configuration.

To build libxml2 from source: In the Visual Studio command prompt enter the following commands:

C:\> cd C:\workspace\libxml2-2.9.7\win32
C:\> cscript configure.js iconv=no ftp=no http=no compiler=msvc prefix=C:\workspace\libxml2-2.9.7\build
C:\> nmake /f Makefile.msvc install

Set environment variables:

  • In order to be detected by CMake, you should than add XML2_HOME environment variable which points to the installation folder C:\my_path\libxml2-2.9.7\build.
    setx XML2_HOME "C:\my_path\libxml2-2.9.7\build"
  • In order that libxml2.dll is found during execution, you should also add C:\workspace\libxml2-2.9.7\build\bin to the PATH environment variable.
    setx PATH "%PATH%;C:\my_path\libxml2-2.9.7\build\bin"

Known issues

Under Windows, if libxml2 is not detected during CMake configuration, you should modify ViSP/CMakeModule/FindXML2.cmake file by commenting lines 49 and 63:

# IF(ICONV_FOUND)
# ENDIF(ICONV_FOUND)

Comments are closed.