Hi,

Firstly -- thanks to Masashi Shimbo for his patch and advice.

Here's a transcript of my installation process.  Apologies for
such a long post! With a clean gem install and the following process
things seem to work if I do a 'require "xml/libxml_so"'.  On OS/X
and Ubuntu though I was able to get things working with an extra
"make install" and can use 'require "xml/libxml" instead.

I'm not sure why my Centos installation is like this, although it
may be needed libraries in non-standard places.


----------------- basic gem install -------------------------------

$ sudo gem install libxml-ruby
Need to update 5 gems from http://gems.rubyforge.org
.....
complete
Building native extensions.  This could take a while...
Makefile:116: warning: overriding commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:114: warning: ignoring old commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:116: warning: overriding commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:114: warning: ignoring old commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:116: warning: overriding commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:114: warning: ignoring old commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
ruby extconf.rb install libxml-ruby
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h... yes
checking for xmlDocFormatDump() in -lxml2... yes
checking for docbCreateFileParserCtxt()... yes
creating extconf.h
creating Makefile

make
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_parser_context.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_sax_parser.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_xpath.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_schema.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_ns.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_document.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_attr.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_xpath_context.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c cbg.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_node.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_dtd.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_node_set.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_parser.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_tree.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c libxml.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_attribute.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_xpointer_context.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_input_cbg.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_xinclude.c
gcc -fPIC -g -O2 -Wall -I. -I/usr/include/libxml2  -I. 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux 
-I/opt/ruby-1.8.4/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H 
-DHAVE_DOCBCREATEFILEPARSERCTXT  -c ruby_xml_xpointer.c
gcc -shared -rdynamic -Wl,-export-dynamic   -L'/opt/ruby-1.8.4/lib' 
-Wl,-R'/opt/ruby-1.8.4/lib' -L'/opt/ruby-1.8.4/lib' 
-Wl,-R'/opt/ruby-1.8.4/lib' -o libxml_so.so ruby_xml_parser_context.o 
ruby_xml_sax_parser.o ruby_xml_xpath.o ruby_xml_schema.o ruby_xml_ns.o 
ruby_xml_document.o ruby_xml_attr.o ruby_xml_xpath_context.o cbg.o 
ruby_xml_node.o ruby_xml_dtd.o ruby_xml_node_set.o ruby_xml_parser.o 
ruby_xml_tree.o libxml.o ruby_xml_attribute.o 
ruby_xml_xpointer_context.o ruby_xml_input_cbg.o ruby_xml_xinclude.o 
ruby_xml_xpointer.o  -lxml2 -lxml2 -lc -lz -lm -lnsl  -ldl -lcrypt -lm   -lc

make install
make: Nothing to be done for `install'.

make clean
Successfully installed libxml-ruby-0.3.8
Installing ri documentation for libxml-ruby-0.3.8...

...

----------------- check gem status --------------------------
                
$ gem check -t libxml-ruby

EXPECTING: TWO ERRORS:
Entity: line 1: parser error : Opening and ending tag mismatch: foo line 
1 and foz
<foo><bar/></foz>
                  ^
Entity: line 1: parser error : Opening and ending tag mismatch: foo line 
1 and foz
<foo><bar/></foz>
                  ^

----------------- apply patch -------------------------------

$ patch -d libxml-ruby-0.3.8 -p1 < fix.patch
patching file ext/xml/extconf.rb
patching file ext/xml/libxml.rb
patching file lib/xml/libxml.rb
patching file Rakefile


----------------- re-run make -------------------------------

$ cd libxml-ruby-0.3.8/ext/xml
$ sudo make install
Makefile:116: warning: overriding commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
Makefile:114: warning: ignoring old commands for target 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml'
make: *** No rule to make target `../xml/libxml.rb', needed by 
`/opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8/ext/xml/libxml.rb'. 
  Stop.

----------------- try Rake install instead --------------------

$ sudo rake install
(in /opt/ruby-1.8.4/lib/ruby/gems/1.8/gems/libxml-ruby-0.3.8)
/opt/ruby-1.8.4/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h... yes
checking for xmlDocFormatDump() in -lxml2... yes
checking for docbCreateFileParserCtxt()... yes
creating extconf.h
creating Makefile
make: Nothing to be done for `all'.
/usr/bin/install -c -m 0755 libxml_so.so 
/opt/ruby-1.8.4/lib/ruby/site_ruby/1.8/x86_64-linux/xml

----------------- try using it ---------------------------------

$ irb
 >> require "rubygems"
=> true
 >> require "xml/libxml"
LoadError: no such file to load -- xml/libxml
         from 
/opt/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`gem_original_require'
         from 
/opt/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`require'
         from (irb):2
 >> require "xml/libxml_so"
=> true


TIA,

Stu
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to