I recently had reason to upgrade to a newer version of Sun Studio on a Solaris 10 system. I had Studio 11 installed but needed to go to version 12 for better support of natively compiled Ruby Gem packages (e.g. mongrel). However, uninstalling Sun Studio is not the most readily documented thing in the world so, for my own future reference, here is the easiest way to do it:
# cd /var/sadm/prod/com.sun.studio_11
After this, just follow the on-screen instructions …
A substantial number of Ruby Gem packages are written in Ruby itself and install quite neatly using a simple
gem install command. However, a number of Gem packages are partly written in C and require some compilation during installation (e.g. hpricot, fastthread and mongrel). This requires you to have a C compiler on the system where you are installing the packages, which is a real pain, but that’s a gripe for another day.
We recently upgraded to CoolStack 1.2 but when we tried to install the Gem packages above, we ran into trouble when the installer attempted to compile the native code for the package. The compiler (Sun Studio 11) complained about the definition of the
NORETURN macro in
/opt/coolstack/lib/ruby/1.8/i386-solaris2.10/config.h as follows:
syntax error before or at: __attribute__
warning: old-style declaration or incorrect type for:
warning: syntax error: empty declaration
cc: acomp failed for hpricot_scan.c
It turns out that the new version of Ruby (1.8.6) that is included with CoolStack 1.2 contains some GCC-oriented macro definitions that Sun Studio 11 does not support. The solution was to upgrade to Studio 12.
Huge thanks go to Basantk for helping to resolve this.
If you are using the Solaris CoolStack edition of Ruby (CSKruby) with Sun Studio 11 (SUNWspro) then you may need to make a small change to one of the Ruby configuration files to tell it where Sun Studio is installed. I would have have expected the installer for the Ruby package to detect this but, alas, it does not.
In my case, this problem will only manifested itself when I attempted to install some platform-specific Ruby Gems packages (hpricot, fastthreads, mongrel).
To remedy this problem:
- Edit the file /opt/coolstack/lib/ruby/1.8/sparc-solaris2.10/rbconfig.rb
- Search for all instances of SUNWspro and change to the correct location
- Save the file and repeat your “gem install” command
It would appear that the version of Ruby that come with Ubuntu Linux (6.06) does not contain everything you might expect. I installed Ruby on Rails version 1.8 onto my system (which requires Ruby and Ruby Gems) but soon after installing it, a colleague realised that I did not have the Interactive Ruby application irb.
We made several attempts to get an updated version of Ruby 1.8 from the internet but no matter what we tried, the system always reinstalled the same, locally held version. We could not seem to figure out how to tell the system to look on the Internet for updated versions of Ruby (and other packages). I was a less than trivial task getting irb installed but here is how we did it.
- We used the Synaptic Package Manager to install Ruby 1.8 and then followed the instructions on the Ruby on Rails website to install Ruby Gems and Ruby on Rails itself.
- Exited from Synaptic Package Manager and continued from the command-line
- Edit /etc/apt/sources.list and uncomment all entries (save file)
- # apt-get update ;;; updates the package listings on this system
- # apt-get clean ;;; removes old package listings (confusing that this command came after the update command)
- # apt-cache search ruby ;;; Look to see if any new Ruby packages are available
- # apt-get install ruby1.8 ;;; Install Ruby 1.8
- # apt-get install irb1.8 ;;; Install Interactive Ruby 1.8
For some reason, the installer does not create the appropriate symbolic links for ruby and irb so you might have to create these manually.
One final note that the apt-get upgrade command can be used to download and install all available updates for your system. This is the same as clicking the orange “Install Updates” icon at the main console. A system reboot will invariably be requried after this.