Installing Ultraviolet and Oniguruma
First install Oniguruma
Oniguruma is a regular expression engine that Ultraviolet uses to parse text; Ruby also uses Oniguruma by the way. If you don’t have Oniguruma on your system you’ll get this error while installing Ultraviolet (at least on Ubuntu Linux):
1 oregexp.c:2:23: error: oniguruma.h: No such file or directory
This tells you that you should download and install Oniguruma. For me version 5.8.0 was the only version that worked, so execute this command to get the right version of Oniguruma:
1 $ wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.8.0.tar.gz
You now have the source package on your computer, so decompress it with the following command:
1 $ tar zxvf onig-5.8.0.tar.gz
If everything went fine, change current directory:
1 $ cd onig-5.8.0/
Next, run configure:
1 $ ./configure
Watch the output closely and fix any errors reported, then run make:
1 $ make
To build and install Onigurama run:
1 $ sudo make install
I managed to get the following errors from Ultraviolet with other versions of Oniguruma, but these went away after installing 5.8.0 and re-installing Oniguruma:
1 Parsing error in // ==UserScript==: wrong number of arguments (2 for 0) #<Textpow::SyntaxNode:0xb7c91780>
Installing Ultraviolet and dependencies
Next install Ultraviolet with RubyGems:
1 $ sudo gem install -r ultraviolet --include-dependencies 2 3 Select which gem to install for your platform (i486-linux) 4 1. oniguruma 1.1.0 (mswin32) 5 2. oniguruma 1.1.0 (ruby) 6 3. Skip this gem 7 4. Cancel installation 8 > 2 9 Building native extensions. This could take a while... 10 Successfully installed ultraviolet-0.10.0 11 Successfully installed textpow-0.9.0 12 Successfully installed oniguruma-1.1.0 13 Successfully installed plist-3.0.0
Test that Ultraviolet works by running the following code with irb:
1 $ irb 2 3 require 'rubygems' 4 require 'uv' 5 puts Uv.syntaxes.join( "\n" ) 6 puts Uv.themes.join( "\n" ) 7 input = <<HTML<<HTML 8 <html> 9 <body> 10 </body> 11 </html> 12 HTMLHTML 13 14 puts Uv.parse( input, "xhtml", "html", true, "slush_poppies")
Problems
You might get this error:
1 require 'uv' 2 LoadError: libonig.so.2: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/oniguruma-1.1.0/lib/oregexp.so
This message is a bit confusing. It means Ruby can’t find libonig.so.2, not oregexp.so as you could believe.
To fix this, check if the library has been linked:
1 $ ldconfig -p|grep libonig
If the library is not linked, add the path to the directory where the file is located to /etc/ld.so.conf:
1 /usr/local/lib 2 3 include /etc/ld.so.conf.d/*.conf
Then run:
1 $ ldconfig
Another way of fixing this problem would be to tell the build script to install it to /usr/lib.
Resume scp download
Unfortunately there is no way for scp to resume a download. Don’t despair though if your download was interrupted. Rsync is capable of resuming it. Be aware though, that rsync makes a temporary file that will become as large as the target file is so your disk may become full during the resume process.
1 rsync --partial --progress --rsh=ssh host:/work/source.tar.bz2 .
Solution to "`require': no such file to load -- readline (LoadError)" problem
If you’ve compiled Ruby from source, you might get this error when executing script/console:
1 /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
One way of fixing this is to compile readline, which is distributed along with the Ruby source:
1 cd /opt/src/ruby-1.8.5-p2/ext/readline 2 ruby extconf.rb 3 make 4 sudo make install
This works even after compiling Ruby, so no need to recompile… If you’re wondering what readline is then this quote from the project homepage sums it up in one sentence: “The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in.”
Fixing "warning: already initialized constant OPTIONS"
If you’re using Edge Rails and mongrel you might have seen this error:
1 warning: already initialized constant OPTIONS
There’s a bug report here that explains this problem in detail.
The solution for me was to rerun the freeze command:
1 rake rails:freeze:edge
You might also get “warning: already initialized constant OPTIONS ” error if you haven’t installed a gem your software relies on. In the following example openssl should be installed:
1 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load—openssl (MissingSourceFile)
ActiveResource might also be the problem:
1 gem install activeresource --source http://gems.rubyonrails.org
Solution to the "Terminal too wide" problem
On Solaris you sometimes get this error when firing up your VI editor:
1 Terminal too wide
One solution is to increase the number of the columns with this command:
1 stty columns 120
An even better solution is to install VIM …