Skip to content

Instantly share code, notes, and snippets.

@jdstroy
Forked from headius/libxml2.markdown
Created November 18, 2012 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdstroy/4104002 to your computer and use it in GitHub Desktop.
Save jdstroy/4104002 to your computer and use it in GitHub Desktop.

Installing libxml2 with NestedVM

Prequisites

curl

darcs

Install NestedVM

First, install NestedVM:

$ git clone http://nestedvm.ibex.org/.git/
$ cd nestedvm.ibex.org
$ make
$ make env.sh
$ . env.sh
$ cd ..

libiconv

Then install libiconv:

$ mkdir $HOME/local
$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
$ tar zxvf libiconv-1.13.1.tar.gz
$ libiconv-1.13.1
$ ./configure --host=mips-unknown-elf --prefix=$HOME/local
$ make && make install
$ cd ..

libxml2

libxml2 must be patched before you can compile it with NestedVM. The patch is very simple though, and I'll include it here.

$ wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
$ tar zxvf libxml2-2.7.6.tar.gz
$ cd libxml2-2.7.6

This is the part where you must patch libxml2. I've included the diff below.

$ patch -p0 < fix.patch
$ ./configure --prefix=$HOME/local \
  --without-zlib \
  --host=mips-unknown-elf \
  --without-http \
  --without-ftp \
  --without-python \
  --with-iconv=$HOME/local
$ make && make install

You should now be ready to write C programs that cross compile against libxml2 on NestedVM. Check out this page for more info.

libxml2 patch

diff --git a/dict.c b/dict.c
index 3eff231..9ec3ed2 100644
--- a/dict.c
+++ b/dict.c
@@ -41,7 +41,7 @@ typedef unsigned __int32 uint32_t;
 #define MAX_HASH_LEN 3
 #define MIN_DICT_SIZE 128
 #define MAX_DICT_HASH 8 * 2048
-#define WITH_BIG_KEY
+/* #define WITH_BIG_KEY */
 
 #ifdef WITH_BIG_KEY
 #define xmlDictComputeKey(dict, name, len)			\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment