- Issue #5
- Work in ~/Projects/libxml2
- I am trying to see if I can use libxml to get the line and column numbers of XPath expressions that come from the Schematron validator.
I first tried to clone from https://git.gnome.org/browse/libxml2, and then run the
steps described here, starting with
./configure
, but that failed. I guess that in the dev repo, there are preliminary
steps required to make the configure script.
So I downloaded the compressed binary bundle libxml2-git-snapshot.tar.gz, and unzipped it to ~/Projects/libxml2/libxml2-2.9.2. Then, I was able to build with:
./configure --prefix=/Users/maloneyc/Projects/libxml2/install
make
make install
After that, the install directory had bin
, include
, lib
, and share
.
I added the bin directory to the front of my PATH:
export PATH=/Users/maloneyc/Projects/libxml2/install/bin:$PATH
Then, I was able to build the test program reader1.c with:
gcc `xml2-config --cflags --libs` -o reader1 reader1.c
See saxparse.c.
-
Downloaded https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz to ~/bin
-
Testing which tools are already installed:
-
python --version
: 2.7.10 -
node -v
: v0.10.32 -
git --version
: 2.4.4 -
java -version
: 1.8.0_45 -
gcc --version
:Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix
-
cmake
: exists
-
-
Setup python2: Entering
python2 --version
gave me "2.7.10".-
Anyway, I did this (not sure if it will help or not)
cd ~/homebrew/bin ln ../Cellar/python/2.7.10/bin/python2.7 python22.7
-
-
Extracting the SDK into ~/bin/emsdk-portable
cd ~/bin tar xvfz emsdk-portable.tar.gz cd emsdk_portable
-
Then:
./emsdk update ./emsdk install latest ./emsdk activate latest source ./emsdk_env.sh
-
Added
source /Users/maloneyc/bin/emsdk_portable/emsdk_env.sh
to .bash_profile.
Verified the installation per [the tutorial](source ./emsdk_env.sh)
emcc -v
returns
INFO root: (Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.34.4
clang version 3.7.0
Target: x86_64-apple-darwin13.4.0
Thread model: posix
INFO root: (Emscripten: Running sanity checks)
Wrote this to hello.c:
#include<stdio.h>
int main() {
printf("hello, world!\n");
return 0;
}
And compiled it with
emcc hello.c
node a.out.js
Works!
I started out by reverse-engineering the Makefile. I abandoned this effort after
realizing I could install a local copy of the library, and use xml2-config
(see
above).
This works to build xmllint:
/bin/sh ./libtool --silent --tag=CC --mode=link gcc -D_REENTRANT -I/Users/maloneyc/homebrew/Cellar/xz/5.2.1/include -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -o xmllint xmllint.o ./libxml2.la -lpthread -lz -L/Users/maloneyc/homebrew/Cellar/xz/5.2.1/lib -llzma -liconv -lm
Works! To link a test program reader1.o -> reader1.c:
/bin/sh ./libtool --silent --tag=CC --mode=link gcc -D_REENTRANT -I/Users/maloneyc/homebrew/Cellar/xz/5.2.1/include -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -o reader1 reader1.o ./libxml2.la -lpthread -lz -L/Users/maloneyc/homebrew/Cellar/xz/5.2.1/lib -llzma -liconv -lm
Try compiling reader1.c -> reader1.o:
gcc -DHAVE_CONFIG_H -I. -I./include -I./include -D_REENTRANT -I/Users/maloneyc/homebrew/Cellar/xz/5.2.1/include -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long
I cloned it from scratch:
git clone https://github.com/hubgit/xml.js.git
cd xml.js
git checkout dtd-validation
git submodule init # Failed with "arch: Can't find perl5.18 in PATH"
To try to fix the problem I tried to install and switch to perl 5.18 with perlbrew:
perlbrew install 5.18.4
perlbrew switch 5.18.4
cd /Users/maloneyc/perl5/perlbrew/perls/perl-5.18.4/bin
ln perl perl5.18
This failed:
While that's working, let's try a later version of git:
$ which git /sw/bin/git $ git --version git version 2.4.4 $ brew update $ brew install git # Tried to install 2.5.0, but failed
Then, I was able to continue with
git submodule init
git submodule update # failed to connect to git.gnome.org
I changed the git clone URL for libxml2 from git://git.gnome.org/libxml2
to
https://git.gnome.org/browse/libxml2
, and it worked.
Then,
npm install
npm install -g gulp
gulp clean
gulp libxml2
gulp compile
gulp test
Loaded http://localhost:8080/git/hubgit/xml.js/test/test.html, and it works!!