XML::DifferenceMarkup installation errors on Ubuntu
Thursday, December 10th, 2009While evaluating some XML diff tools, we came across XML::Diff, XML::SemanticDiff and XML::DifferenceMarkup. Installing XML::Diff and XML::SemanticDiff was not a problem on Ubuntu using perl’s MCPAN shell:
perl -MCPAN -e shell
Unfortunately those two packages did things differently than we expected, for that reason we could not use any of them. Instead I decided to give XML::DifferenceMarkup a try. At first I tried MCPAN but failed. Next I tried downloading the source and installing it but kept failing on the “perl Makefile.PL” stage with the following error:
enable native perl UTF8
running xml2-config… ok
diffmark headers not found
Try setting LIBS and INC values on the command line,
or get diffmark from
http://www.mangrove.cz/diffmark/
This was weird because I already had libxml2 installed because I thought the installation was not able to find libxml2 headers. I tried setting the LIBS and INC on the command like using:
perl Makefile.PL ‘INC=-I/usr/include/libxml2′ ‘LIBS=-L/usr/local/lib -lxml2 -lz -lpthread -lm’
but nothing worked. The problem was that I was focusing on the wrong part of the error message. I didn’t notice that it required me to install diffmark. When I saw that I followed the URL which gave me an explanation of what diffmark is and a download link. I proceeded to download, untar and read the installation notes:
./configure
make
make install
seems simple enough. Of course nothing ever is that simple. Running ./configure gave me a glimpse into Ubuntu’s base install, it doesn’t have any C++ compilers:
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… no
checking for mawk… mawk
checking whether make sets $(MAKE)… yes
checking for g++… no
checking for c++… no
checking for gpp… no
checking for aCC… no
checking for CC… no
checking for cxx… no
checking for cc++… no
checking for cl.exe… no
checking for FCC… no
checking for KCC… no
checking for RCC… no
checking for xlC_r… no
checking for xlC… no
checking for C++ compiler default output file name…
configure: error: C++ compiler cannot create executables
See `config.log’ for more details.
So I decided to install one.I picked the first “g++”. Using Synaptic Package Manager I installed g++ (I had problems downloading. I will post a different article to discuss that point). I then went back to configuring diffmark and all was well. Finally I can install… not so fast. Make generated the following error:
merge.cc: In member function ‘bool Merge::is_reserved(xmlNs*) const’:
merge.cc:339: error: ’strcmp’ was not declared in this scope
Not my lucky day. Seems like merge.hh does not have any declarations for strcmp. Openning lib/merge.cc up I saw that the top of the file did have the line:
#include <string>
After some more digging into the code I noticed that some other header files and source files actually use string.h or both. So I decided to change that like to:
#include <string.h>
Running make finally went through. I then ran a “sudo make install” and diffmark was installed. From there installing XML::DifferenceMarkup was pretty much straight forward. Hopefully this module will provide the right functions we need.