About Me

Curriculum Vitae

A brief list of my current skill set

Bloggybits

MinnaHTML.js Benchmarking for Speed in Node.js
Monday, 13th August 2012, 17:55

Don't believe it, test it

Playing Around With HTML5's Canvas
Friday, 10th August 2012, 16:19

Speccy loading screens in a browser!

Scripting in Node.js AKA How to Watch for Olympic Tickets Using a Script
Tuesday, 7th August 2012, 23:37

Let Node refresh the webpage so you don't have to!

A Javascript Confirm/Alert Replacement jQuery Plugin
Monday, 6th August 2012, 23:06

Much prettier than the horrible alert and confirm dialogs

A Few Node.js Essential Modules
Friday, 3rd August 2012, 14:40

As essential as they can be anyway

Retro Coding Corner: Loading ZX Spectrum Snapshots off Microdrives - Part 2
Tuesday, 31st July 2012, 18:20

It's like juggling 8 balls with one hand behind your back

One Layout To Rule Them All
Monday, 30th July 2012, 16:03

Designing a layout to fit every screen

Retro Coding Corner: Loading ZX Spectrum Snapshots off Microdrives - Part 1
Thursday, 26th July 2012, 16:57

From emulation to super fast tape

Upgrading Libxml2 on CentOS 5.8 fixes Libxmljs
Wednesday, 25th July 2012, 11:33

Fixes strange compile errors and everyfin

Installing Node.js 0.8.x under CentOS 5.8
Tuesday, 24th July 2012, 14:13

It's just an upgrade of Python away

Node.js and Object Oriented Programming
Sunday, 22nd July 2012, 23:46

Make pages inherit pages

MinnaHTML.js - A HTML Web Framework For Node.js
Saturday, 14th July 2012, 22:53

Make webpages the OOP way

Everyone Should Learn to Debug Without a Debugger
Monday, 11th June 2012, 22:42

Because one day they'll all get eaten

Geeky Things What I Wrote Elsewhere
Wednesday, 2nd May 2012, 17:51

A few links to geeky articles I posted on another website

How to Get TypeKit to Working Inside TinyMCE
Monday, 2nd April 2012, 20:36

It's all about the setup baby

Projects and Sillyness

MAME Cabinet Diary

How I built my own arcade cabinet

Loading Screen Simulator

I don't miss the ZX Spectrum, I still use it!

The Little Guy Chat Room

It's a Pitfall inspired chat room

GPMad MP3

A fully featured MP3 player what I wrote

GP Space Invaders

My first little emulator

GP32 Development Page

Some info and links about this cute little handheld

Disney Nasties

Uncensored images, you must be 18 to view them

Diary of a Hamster

Learn about how hamsters think, first hand

Utilities

Time Calculator

A simple little online utility for working out how many hours to bill a client

A Few Links

Upgrading Libxml2 on CentOS 5.8 fixes Libxmljs
Wednesday, 25th July 2012, 11:33

Another day, another diatribe on the frustrations of CentOS 5.8, well okay maybe not quite that bad. In fact, more of another how to fix something which is broken because CentOS packages are out of date, which wouldn't be an issue if you could easily migrate to the next major version like you can with OpenBSD, but I digress.

So, for a while now, the Node.js module Libxmljs has relied on a later version of Libxml2 than CentOS 5.8 ships with, when you build it errors like the following show up:

Waf: Entering directory /node_modules/libxmljs/build'
[ 1/10] cxx: src/libxmljs.cc -> build/Release/src/libxmljs_1.o
cc1plus: warnings being treated as errors
/usr/local/include/node/ev-emul.h: In function ‘void __ev_timer_start(__ev_timer*)’:
/usr/local/include/node/ev-emul.h:203: warning: passing ‘double’ for argument 3 to ‘int uv_timer_start(uv_timer_t*, void (*)(uv_timer_t*, int), int64_t, int64_t)’
/usr/local/include/node/ev-emul.h:203: warning: passing ‘double’ for argument 4 to ‘int uv_timer_start(uv_timer_t*, void (*)(uv_timer_t*, int), int64_t, int64_t)’
Waf: Leaving directory/node_modules/libxmljs/build'

Or maybe even this:

Waf: Entering directory /root/nLocate/node_modules/libxmljs/build'
[ 1/10] cxx: src/libxmljs.cc -> build/default/src/libxmljs_1.o
[ 2/10] cxx: src/xml_attribute.cc -> build/default/src/xml_attribute_1.o
[ 3/10] cxx: src/xml_document.cc -> build/default/src/xml_document_1.o
[ 4/10] cxx: src/xml_element.cc -> build/default/src/xml_element_1.o
cc1plus: warnings being treated as errors
../src/xml_element.cc: In static member function ‘static v8::Handle libxmljs::XmlElement::ChildNodes(const v8::Arguments&)’:
../src/xml_element.cc:207: warning: passing ‘double’ for argument 1 to ‘v8::Handle libxmljs::XmlElement::get_child(int32_t)’
[ 5/10] cxx: src/xml_namespace.cc -> build/default/src/xml_namespace_1.o
../src/xml_namespace.cc: In constructor ‘libxmljs::XmlNamespace::XmlNamespace(xmlNs*)’:
../src/xml_namespace.cc:67: error: ‘struct _xmlNs’ has no member named ‘context’
../src/xml_namespace.cc:70: error: ‘struct _xmlNs’ has no member named ‘context’
../src/xml_namespace.cc: In destructor ‘virtual libxmljs::XmlNamespace::~XmlNamespace()’:
../src/xml_namespace.cc:79: error: ‘struct _xmlNs’ has no member named ‘context’
../src/xml_namespace.cc:82: error: ‘struct _xmlNs’ has no member named ‘context’
Waf: Leaving directory/root/nLocate/node_modules/libxmljs/build'

In fact, generally, if you npm install libxmljs and get any sort of error that reads similar to the above, run the following command and see what version of Libxml2 you are actually running:

prompt# xml2-config --version

If it says 2.6.x then there is a very good chance this is where your problem lies, and no amount of yum updating is going to fix it.

Installing Libxml2 from RPM

This method is a little more involved, but it definitely works. I didn't come up with it, I found it on serverfault.com posted by Chad Feller.

The steps required are as follows. Firstly, install the CentOS development tools which include various packages you will need to make RPMs.

prompt# cd /home/somewhere_to_store_it
prompt# yum groupinstall "Development Tools"
prompt# yum install python-devel
prompt# wget http://xmlsoft.org/sources/libxml2-2.7.8-1.src.rpm

Now these next command apparently build the RPM, but it isn't signed so you will get warnings about that.

prompt# rpm -ivh libxml2-2.7.8-1.src.rpm --nomd5
prompt# rpmbuild -ba /usr/src/redhat/SPECS/libxml2.spec

It's quite possible if you are missing dependencies that you'll need to yum install them, but I didn't, and I suspect it won't contain anything that the older Libxml2 version didn't already need. If you do, then you'll need to install those and re-run the above rpmbuild command.

Now what follows requires you to know what archicture your server uses, for me it is the following for my test 32-bit server that runs under a VM:

prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/i386/libxml2-2.7.8-1.i386.rpm
prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/i386/libxml2-python-2.7.8-1.i386.rpm
prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/i386/libxml2-devel-2.7.8-1.i386.rpm

And for my 64bit live server:

prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/x86_64/libxml2-2.7.8-1.x86_64.rpm
prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/x86_64/libxml2-python-2.7.8-1.x86_64.rpm
prompt# yum localinstall --nogpgcheck /usr/src/redhat/RPMS/x86_64/libxml2-devel-2.7.8-1.x86_64.rpm

Chances are, if your architecture doesn't match the above, you can find the newly made libxml2 files somewhere under /usr/src/redhat/RPMS/ with a bit of a hunt.

Installing Libxml2 from Source

I seem to have actually managed this myself, so it must work. The problem is I'm not entirely sure exactly what I did, beyond downloading, running a standard ./configure, and then make/make installing.

So in theory it should work, just download libxml2-2.7.8 from the following URL and give it a go: ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz

Libxmljs

This should now work, just to make sure, though, remove the directory and run the npm install command.

prompt# npm install libxmljs

Comments

Add Your Own Comment