Nick Sellen

Compiling Nokogiri gem on Solaris 10 with Sun Studio

28 Jan 2010

It turns out the nokogiri build script makes a few too many assumptions:

  1. it tests for Solaris-ness by checking target_os is solaris2 where on Solaris 10 it is solaris2.10
  2. it assumes gcc and sets a bunch of invalid CFLAGS such as -Wall
  3. it doesn't let me specify a custom lib/include directories - it failed to find my iconv because of this (furthermore after adding the paths manually misleadingly it still said it couldn't find them but the problem was the options passed to cc were incorrect)
  4. further down the line something decided it knew where Sun Studio was. It was wrong. to be fair this probably wasn't nokogiri's fault.


I've ended up using gcc for compiling ruby related things which knocks out problems 2-4.

However I started seeing problems with a vasprintf symbol not found (similar to this problem). The problem is the same as my point 1 above (in ext/nokogiri/extconf.rb line:22):

elsif Config::CONFIG['target_os'] == 'solaris2'

should read

elsif Config::CONFIG['target_os'] =~/solaris/

For reference

# ruby -rrbconfig -e "puts Config::CONFIG['target_os']"

Update 2

It's fixed by this commit