Installing native RubyGems packages in the new Power8 Ubuntu Little Endian platform
IBM Power8 Systems now run the popular Ubuntu distro. With Ubuntu it is now very easy to run ruby based applications on Power8 systems and get all the advantages of an enterprise class system (e.g. up to 2TB of RAM, 2 CPUs with up to 12 hardware threads each and so on). Ruby applications often make use of packaged ruby gems downloaded from rubygems.org. But some of these ruby gems include native extensions in the form of source code tar balls which need to be built during installation. For example, the nokogiri ruby gem includes the source code for libxml2 and libxslt libraries. When installing such ruby gems on the new Power8 Ubuntu LE platform (also code named ppc64le), sometimes users may encounter compilation errors like this.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options
/var/lib/gems/1.9.1/gems/mini_portile-0.6.0/lib/mini_portile.rb:279:in `block in execute': Failed to complete configure task (RuntimeError)
Look at the partially installed gem directory:
You may see any error like this:
UNAME_MACHINE = ppc64le
UNAME_RELEASE = 3.13.0-17-generic
UNAME_SYSTEM = Linux
UNAME_VERSION = #37-Ubuntu SMP Mon Mar 10 21:47:19 UTC 2014
configure: error: cannot guess build type; you must specify one
This error occurs because the config.guess files used by the GNU build system for building the included source tar balls does not recognize the new Power8 Ubuntu platform.
To work around this issue, I used the following steps:
Download the latest config.guess file from the following location in a browser: http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD .
Save the web page as a Text Document into a file which I named config.guess.
- Download the source code tar ball for libxml2 and libxslt from the following links: ftp://ftp.xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz and ftp://ftp.xmlsoft.org/libxml2/libxslt-1.1.28.tar.gz
- Replace the config.guess file in these source tar balls with the latest one and upload the modified tar balls to my own file server
- Install the rake compiler dev box using vagrant from: https://github.com/tjschuck/rake-compiler-dev-box
- Bring up the vagrant box, Install ruby version 1.9.2 like this: rvm install 1.9.2 ; rvm use 1.9.2 ; gem install bundle ; gem install rake
Download the source for the nokogiri gem from github.com like this:
git clone https://github.com/sparklemotion/nokogiri.git
- Change into the nokogiri directory. Open the file ext/nokogiri/extconf.rb and replace the download location for the libxml2 and the libxslt source tar balls to the file server used in step 3.
- Execute “ruby ext/nokogiri/extconf.rb”. This should download the modified libxml2 and libxslt source tar balls into the sub-directory: ports/archives
- Execute “bundle exec rake clean” followed by “bundle exec rake gem”
- Now your fixed gem file should be available under the pkg directory e.g. pkg/nokogiri-184.108.40.206.gem
- Transfer the modified gem file to your Power8 Ubuntu LE machine and install it using the command: gem install -l nokogiri-220.127.116.11.gem