3

The latest MacRuby release notes (v0.6) state that the authors have managed to get this release working with the SQLite and Nokogiri gems. However when I run sudo macgem install nokogiri I get the following errors:

ERROR:  Error installing nokogiri:

extconf failed:

and then a bunch of paths followed by:

libxml2 is missing.  try 'port install libxml2' or 'yum install libxml2'
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/nokogiri-1.4.1/ext/nokogiri/extconf.rb:1:in `<main>': libxml2 is missing.  try 'port install libxml2' or 'yum install libxml2' (SystemExit)

Anyone knows how to get this working? My platform is Mac OS X 10.6.3. Nokogiri normally (meaining on plain old ruby 1.8.7) installs without a problem.

Progress

OK, so I have:

  1. git clone http://github.com/tenderlove/nokogiri.git
  2. cd nokogiri/ext/nokogiri
  3. Then I've rebuilt the macports libraries with sudo port upgrade --enforce-variants libxml2 +universal and sudo port upgrade --enforce-variants libxslt +universal
  4. Then I've executed macruby extconf.rb successfully
  5. Then I proceed to make

At this point it errors out like so:

/usr/bin/gcc -I. -I/opt/local/include/libxml2 -I/opt/local/include/ -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include  -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -arch i386 -arch x86_64 -o html_document.o -c html_document.c
In file included from ./html_document.h:4,
             from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
In file included from ./html_document.h:4,
             from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
lipo: can't open input file: /var/folders/wU/wUGgoG1JGeKBgwalWLPMAU+++TI/-Tmp-//ccSgAUv5.out (No such file or directory)
make: *** [html_document.o] Error 1
Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106

4 Answers4

1

I think you have to build from source since only Nokogiri's head is MacRuby compliant

Matt Aimonetti
  • 1,112
  • 1
  • 10
  • 11
  • How exactly do I build it from source? I tried cloning the repository, and tried doing `macrake build` in there. That gave me a load of warning and errored out. Then I found somewhere that I have to cd to ext/nokogiri and run `macruby extconfig.rb`. However this fails to find libxml2 which I have installed using macports. Any tips? Thanks! – Jakub Hampl May 06 '10 at 14:37
1

I think you have to build a libxml2 as Universal binary.

If you use MacPorts, execute the command below.

$ sudo port upgrade --enforce-variants libxml2 +universal
$ sudo port upgrade --enforce-variants libxslt +universal
$ sudo port upgrade --enforce-variants sqlite3 +universal

It still fails in the installation (x _ x;

$ sudo macgem install nokogiri                   
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
 make failed:

["/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby extconf.rb", "checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for xmlParseDoc() in -lxml2... yes\nchecking for xsltParseStylesheetDoc() in -lxslt... yes\nchecking for exsltFuncRegister() in -lexslt... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetParserStructuredErrors()... yes\ncreating Makefile\n", "make", "/usr/bin/gcc -I. -I/opt/local/include/libxml2 -I/opt/local/include/ -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include  -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -arch i386 -arch x86_64 -o html_document.o -c html_document.c\nIn file included from ./nokogiri.h:75,\n                 from ./html_document.h:4,\n                 from html_document.c:1:\n./xml_document.h:5:16: error: st.h: No such file or directory\nIn file included from ./nokogiri.h:75,\n                 from ./html_document.h:4,\n                 from html_document.c:1:\n./xml_document.h:5:16: error: st.h: No such file or directory\nlipo: can't open input file: /var/tmp//cco5nNYw.out (No such file or directory)\nmake: *** [html_document.o] Error 1\n"]
Kamek
  • 3,383
  • 1
  • 16
  • 9
Watson
  • 141
  • 4
  • Thanks, I've rebuilt before with the +universal variant but forgot to pass --enforce-variants. Still fails with make however. – Jakub Hampl May 06 '10 at 16:51
1

If you use the source code of GitHub,

$ git clone git://github.com/tenderlove/nokogiri.git
$ cd nokogiri/ext/nokogiri/
$ sed -i.bak 's/<st.h>/<ruby\/st.h>/' nokogiri.h

If you make a gem package of Nokogiri,

$ cd ../..
$ sudo gem install hoe
$ sudo gem install rake-compiler
$ sudo gem install racc
$ sudo gem install rexical
$ mkdir ~/.rubyforge; touch ~/.rubyforge/user-config.yml
$ rake gem

An Above command, I used ruby of the system default. ("/usr/bin/ruby")

$ cd pkg
$ sudo macgem install nokogiri-1.4.1.gem
Watson
  • 141
  • 4
  • I get this bizzare error when doing the `rake gem` step: Either it errors out with `expected DOCUMENT_START event` and when I `--trace` it it starts with the following trace: `/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/hoe-2.6.0/lib/hoe/rubyforge.rb:20:in 'define_rubyforge_tasks'` This feels wierd since I'm using normal ruby, why is it searching the Macruby path? So I tried uninstalling the Macruby version of Hoe and now it reports `Could not find RubyGem hoe (>= 2.1.0)`. – Jakub Hampl May 10 '10 at 16:31
  • I think whether you installed rake in macgem. This rake command installed to "/usr/bin/rake". I think whether you executed a command in this place.
    $ sudo macgem install rake
    $ less /usr/bin/rake
    If you look at the line of the beginning of the output of the less command, you understand that this is macrake.
    – Watson May 10 '10 at 23:11
  • You would uninstall the all packages which you installed in macgem, and then try the "rake gem". – Watson May 10 '10 at 23:14
  • Beforehand, please execute a "sudo /usr/bin/gem install rake". – Watson May 10 '10 at 23:28
  • I'm sorry, but I'm a bit confused as to what exactly should I do now. – Jakub Hampl May 12 '10 at 03:16
  • OK, so I (somehow) managed to build the gem locally. Then I executed `cd pkg` and `sudo macgem install nokogiri-1.4.1.gem` - this gives a `make failed` message followed with 3 pages of stack trace. – Jakub Hampl May 12 '10 at 03:43
0

I uploaded to GitHub which I made a package. http://wiki.github.com/Watson1978/nokogiri-macruby/

Watson
  • 141
  • 4
  • Same error as before. That is `make failed`. I really appreciate all the effort you are putting into this. Thank you very much. – Jakub Hampl May 14 '10 at 00:57