Friday Apr 10, 2009

how to build webstack

@http://webtier.sfbay.sun.com/webtier/Wiki.jsp?page=WebStack1.4Builds

Simple guide:

1) sun studio12 and SUNWmercurial ready

2) check out

   # mkdir webstack

   # cd webstack

   # hg clone ssh://anon@72.5.123.5/hg/webstack/wsbuild   //the ip is for hg.opensolaris.org

   # hg clone ssh://anon@72.5.123.5/hg/webstack/wslibs

   # hg clone ssh://$UID@72.5.123.5/hg/webstack/$COMPONENT

   for example UID=chriszhu; COMPONENT=ruby

3) building

   # cd wslibs ; gmake install

   # cd $COMPONENT; gmake pkg

4) make sure .hgrc is in home directory before commit and push

   [ui]

   username = Chris Zhu <chris.zhu@sun.com>

5) putbach

   # hg pull // update the current repository to latest version

   # hg commit

   for example: 6806740 upgrade web stack ruby to 1.8.7

   # hg push

6) change the CR status to fix delivered

Useful commands

   hg add/remove/diff

   hg status/parents/log/log -v

   hg merge/commit/pull/push



How to choose boot system - solaris or linux

State 1:

# ssh admin@<hostname>-sp

// To reboot

$ platform set os state reboot -f

// To monitor the output of console, and choose the boot system in console

$ platform console

State 2: ILOM

# ssh root@<hostname>-sp   // default passwd is changeme

// To reboot

-> reset /SYS

// To monitor the output of console, and choose the boot system in console

-> start /SP/console



How to do putback to sfw-nv

Checking before putback

1) $ workspace parent -p sfwnv-gate

2) login to sfwnv.sfbay

3) share the workspace

4) set path

5) $ ws <workspace>

6) $ putback -n

7) $ wx pbchk

8) $ putback  // add comment here which is same as wx ea

Attentions:

If we have made any change to the package info, such as pkginfo.tmpl, we should send mail to gatekeeper@sfwnv to notify the change.

Useful commands:

$ bringover -p sfwnv-clone -w ./WS usr/src

$ bldenv sfw-developer.sh

$ wx edit/checkin/create/uncreate/delete

$ wx list/out/diffs/tdiffs/pdiffs/

$ wx ea/webrev/pbchk/redelget

$ env - /ws/onnv-tools/onbld/bin/nightly sfw-devloper.sh

$ ws ./WS

$ workspace -h

Setting up build environment:

Please don't link /opt/onbld to /ws/onnv-tools/onbld when setting up a build system. The version of SUNWonbld available from the nis automounts is often out of date and may cause your builds to fail. Always download and install the latest SUNWonbld package from: http://dlc.sun.com/osol/on/downloads/current/


Tuesday Nov 04, 2008

The 4-2-1 family type in the aging society

A talk show caught my eyes last night, it concentrated on the nursing homes in Beijing, and you will find part of the old person in the nursing home are more than 80 years old, it's a little difficult for their 60 years old son or daughter to take care of them.

Then I search a lot on the internet, it's reported that China has become an aging society since 1999. By the end of 2004, people over 60 years old had reached 143 million, accounting for about 11 percent of the nation's total population. And it's expected to reach its peak of 437 million by 2051 and the twenty years starting from 2030 will be a crucial period for the aging problem in China. In 2030 I will be more than 50, and in 2051, I will be 70, be one of the aging society.

The report held that China is a typical country that faces the challenge of an aging society before getting rich, so the social security system, the medical care resources, and the humane care for old person are big challenges in the near feature.

But I think there's also an another challenge for Chinese people. According to the one-child policy in China, the tendency of population increase has been effectively brought under control, but more and more Chinese families now go into the 4-2-1 type, which stands for four old people being the parents of the husband and wife, the couple themselves and their only child. It's an inverted pyramid style, and seems not stable enough to all kinds of problems. The only child makes him or her the core of the family, the status of the couple affect the family a lot,and the old person should pay more attention to their health. And how about twenty years later, a new family style 8-4-2-1 will come out, now babies are brought up to have their own family and child now, what they faced is not only their social role, but also a large family, people wondered if the new generation who are growing up in love and hope can be strong enough to face all the problems without any support.

Actually, how to make an assured and happy life for old people can help a lot  to make 4-2-1 family  more stable.


Tuesday Oct 21, 2008

Just coming after the black screen of windows xp ...

It's announced by Microsoft China, since Oct.20, the pirated Windows xp will be initiated black-screens every 60 minutes, and a transparent watermark will be notified at the bottom right of the screen., what Microsoft called the “persistent desktop notification”. 

The news was released a week ago, my mom was so scared about it, so she call me on last Saturday and kept asking me what to be done. I think it's a common feeling of millions of people in China, who have no ideas of computer, applications or OS, and run windows just for fun. I asked my mom to be relax, and help her to close the windows live update, then I told her we can do nothing before it happened. Fortunately, there's no punishment in the sweep against piracy, the blackout is not so serious as we imagine, no vanishing icons, no needs for reboot, just the desktop is changed into a black background instead of whatever the wallpaper is.

My mon don't met the problem yet, and she feels ok now, but the interesting thing is what happened after the news.

1) Last night a discussion is raised from the Microsoft announcement to the patent problems in China between my husband and his friend in Germany, which is the main problem of patent, people's concept of patent, or the law status of a country, orthe marketing strategy. It's a conversation in men , and I just care about my mom's computer.

2) A set of solving suggestions just came out with the notification. Now you have 7 options to cover the problem, and the last one of the list is to buy a genuine Windows. It seems anti-piracy is never a gap for end users.

3) A lot of debates are raised about the Microsoft's anti-piracy campaign. Although patent is accepted by more and more people in China, people reject to pay so much for a windows or office license. People thought Microsoft has won a lot in marketing share by the piracy distribution, so release a home version for free is a more generous way to millions and millions of end users. Also technical people think it's not only for genuine advantage, but also a show of windows vista. Why does the anti-piracy campaign just aim at XP when it isn't even available any more.  Wouldn't they have to go with Vista instead?  It looks like it's more of an initiative to get Vista in the hands of users than anything else.

4) People also suggested to use other OS to instead of Windows, like Mac OS, Redhat, free BSD. It's really a good news for open source, but unfortunately I don't find Open Solaris any more. It's still a long way for us to go.



Friday Oct 10, 2008

Find and Try faster ruby for solaris on RubyForge

An optimized version of ruby 1.8.6 p110 for Solaris nv and Open Solaris is released on RubyForge, which is coincident with what embed in Solaris nv. See release info in http://blogs.sun.com/chriszhu/entry/release_of_ruby_1_8

Go to http://rubyforge.org/projects/rubyopensolaris/ to download the streamed ruby packages for both sparc and x86. If you want to look into the source code or build by yourself, the source code is also ready for download.

A simple script "makeruby.sh" is integrated in the source code, which can help to build by a single command for you.Here is a simple guide for how to build the ruby on solaris.

  1) Download ruby1.8.6-p110-snv-src.tar.bz2
     # bunzip2 -dc ruby1.8.6-p110-snv-src.tar.bz2 | gtar xpf - --no-same-owner

  2) Make sure your are in directory ruby1.8.6-p110-snv-src for all the following steps.
     # cd ruby1.8.6-p110-snv-src

  3) The shell script makeruby.sh can help to build Ruby 1.8.6 p110 and RubyGem 0.9.4, you can run following command for help.
     # makeruby.sh -h

   There are two options for building:
  • --ruby-prefix=DIR :
The default target ruby prefix dir is /usr/ruby/1.8, while the gem repository is /var/ruby/1.8/gem_home And you can specify your own target dir by "--ruby-prefix=/You/Own/Dir", but it must be an absolute path, as  relative path is not acceptable for ruby prefix.
For example:
# makeruby.sh --ruby-prefix=/export/home/ruby/build
  • --sunstudio :
gcc is the default building environment, as sun studio is not installed by default on solaris. gcc located in /usr/sfw/bin by default, make sure the /usr/sfw/bin is set in the environment of PATH
Actually you are suggested tp use sun studio as your building environment by "--sunstudio", if it's ready on your machine. Because we have made a lot of improvements on sun studio building options, which will help you to achieve faster ruby on solaris.
For example:
# makeruby.sh --sunstudio
  4) Make clean by:
     # makeruby.sh clean

Release of Ruby 1.8.6 p110 for solaris on RubyForge

Release on http://rubyforge.org/projects/rubyopensolaris/:

Ruby is integrated into Solaris since nv78, now we released a coincident version of ruby 1.8.6 p110 on RubyForge, so people can try faster ruby on solaris x86 or sparc and feel free to raise bugs by http://rubyforge.org/projects/rubyopensolaris/. New ruby version will be continuously updated to the project just following the steps of ruby on Solaris nv.

New features are added to Ruby 1.8.6 p110 for Solaris, and some specifications are made according the Solaris software management system, also bugs got fixed in the released version.

Specificaion:
  • Ruby 1.8.6 p110 is installed in /usr/ruby/1.8 by adding package SUNWruby18u
  • Gems repository is installed in /var/ruby/1.8/gem_home by adding package  SUNWruby18r
  • Add soft links for ruby executable programs in /usr/ruby/1.8/bin in /usr/bin.
For example:
/usr/bin/ruby18 is a soft link of /usr/ruby/1.8/bin/ruby,
/usr/bin/ruby is a soft link of /usr/bin/ruby18, if 1.8 is the latest version on the system.
New features:
  •  Add dtrace support for ruby 1.8.6 p110 on Solaris x86, which includes following probes:
> function__entry
> function__return
> raise
> rescue
> line
> gc__begin
> gc__end
> object__create__start
> object__create__done
> object__free
> ruby__probe
The support for sparc will come soon. There's still a bug on probe object__free, which is not suggested to be active now.
  •  The ruby 1.8.6 p110 for Solaris x86 and sparc are optimized by sun studio building options.
  •  Ext readline 5.2 is built in ruby 1.8.6 p110
  •  Add man page for gem
Bugs Fixed:
  •  The ruby 1.8.6 p110 for Solaris sparc is optimized by removing unnecessary windows flushing.
  •  Fix the rdoc files generated unpredictably problem

        
    

Monday May 05, 2008

Install and upgrade sparc machines by jumpstart

It's easy and convenient to install system by jumpstart, especially for those sparc machines, and for x86 or more informations of jumpstart, please see the following links:

http://www.sun.com/bigadmin/features/articles/jumpstart_x86_x64.jsp

http://docs.sun.com/app/docs/doc/817-5506/epucy?a=view 

1) Setup install server in the right place you expected, you can choose any machine as the jumpstart server(sparc or x86)

    For example:

          # cd /net/bounty/export/nv/[s/x]/[version number]/Solaris_11/Tools

# ./setup_install_server /export/home/jumpstart/nv88

Here s stands for sparc machine, while x stands for x86, and choose the exact version you wished.

2) Add net info to hosts,ipnodes,ethers and nsswitch.conf

  • add the ip and host name of server and client into /erc/hosts and /etc/imet/ipnodes

          For exampler:   

                    192.1.1.1 servername
                    192.1.1.2 clientname

  • add the mac address of client into /etc/ethers

          For example:   0:0:00:00:00:00 clientname

  • check nsswitch.conf to confirm ethers and hosts info are read from file    
           ethers  files nis
           hosts   files nis

 3) config the jumpstart files

I create a new directory(/export/home/jumpstart/config) for all the config files. Here's a config example from Solaris-11/Misc/jumpstart_sample. You can copy it and made your own modification.

Actually I don't know how to make an automatic installation or upgrade without any interactive effect.

You can find detail configure parameters in http://docs.sun.com/app/docs/doc/817-5506/preparecustom-56440?a=view 
  • add sysidcfg for installation initialization
           For example:

network_interface=eri0
{hostname=clientname

ip_address=192.1.1.2
netmask=255.255.255.0}
security_policy=none
name_service=NIS+
{domain_name=eri.PRC.Sun.COM}
timezone=Asia/Shanghai
system_locale=en_US
terminal=dtterm
timeserver=localhost
root_password=<encrypted from /etc/shadow>

  • made your own profile file

Examples for installation:

install_type initial_install
system_type standalone
partitioning explicit
cluster SUNWCall
filesys c0t1s0 30720 /
filesys c0t1s1 4096 swap
filesys c0t1s7 free /export/home 

Examples for upgrade: 
install_type upgrade
  • Change the file rules

     The rules file is a text file that contains a rule for each group of systems on which you want to install the Solaris OS. I choose the simplest one, define the profile file for expected hostname.

    For example:

        hostname  clientname   - upgrade_file   -

5) Now add client in the jumpstart server.

     For example:

        # cd /export/home/jumpstart/nv88/Solaris/Tools/

        # ./add_install_client -c servername:/export/home/jumpstart/config \\

                                            -s servername:/export/home/jumpstart/nv88   \\

                                            clientname  sun4u

The type of platform can be get by "uname -p". The configure and installation directories are shared automatically.

6) Ok, now came to the client side, boot the system by one of the following commands.

ok> boot net - install

# reboot net - install

7) I'd like to remove the client after installation.

  # ./rm_install_client clientname
                 

Monday Apr 07, 2008

Try virtual box

Since Sun bought Innotek, Virtual Box is part of Sun now. And after trying VirtualBox 1.5.6 (windows x86), I think it's more simple and convenient than vmWare on GUI.

The binary is ready on http://www.virtualbox.org/wiki/Downloads, which will lead to Sun download center finally.

I'm going to simulate different versions of solaris on my laptop, which is windows based system.

It's really simple to create a independent OS

1) Create a virtual machine

2) Set the name and right type. For me, it's solaris of course.

3) Set enough memory size for the OS, for example 896M memory is necessary for nv

4) Bind a disk to OS, you can create a virtual disk here, which supposed to be a Dynamically expanding image with enough space.

5) You'd better mount the CD/DVD-Rom for the virtual machine, which is necessary for installation.

Same as vmWare, you can share the image with others, which can pass over the installation process by just a copy.

And I think it's smooth to use it to simulate Solaris, the only question is I don't have enough space for it.  So why not just try it?


 

For running VirtualBox on Solaris, the following link may be helpful.

http://blogs.sun.com/JoeBonasera/entry/using_the_virtualbox_hypervisor_on

How to setup Regperf test with ROR & postgres8.2

Regperf 1.0

According to blog of Damien Cooke and Tom Daly, I setup the Regperf test for Ruby on Rails to comparing ruby 1.8.6 with darryl's ruby for database accessing. The genre of applications that Regperf belongs to is usually used for very simple, one or more table, applications to Create/Read/Update/Delete simple data for a particular purpose.

Preparation

  1) sun studio is ready on solaris

  2) ruby 1.8.6 is ready on solaris

  3) postgres 8.2 is ready on solaris

Step 1, Install the database

  1. We will add a new user "regperf" to run the whole test.

    # useradd -m -d /export/regperf -s /usr/bin/bash regperf

    # su - regperf 

  2. creates a new PostgreSQL database cluster on /export/regperf/data.

    -bash-3.2$ initdb -D ./data

  3. The database server can be started by following two commands (just choose one).

    -bash-3.2$ postmaster -D ./data

    -bash-3.2$ pg_ctl -D ./data -l logfile start 

  4. Setup the postgres database, the Sample Database is got from Damien's blog.   

    4.1) create regperf user.

       -bash-3.2$ createuser damien

       -bash-3.2$ createuser postgres

    4.2) create a database called regperf.

       -bash-3.2$ createdb regperf

    4.3) import the database, most of the errors can be ignored.

       -bash-3.2$ pg_restore -d regperf regperfdb.tar

  5. using psql to check the detail info of database.

       -bash-3.2$   psql regperf

       listing tables ----  regperf=#  \\dt   

       listing items  ----  regperf=#  select \* from subscriptions;  

  6. If you want to use remote client to access postgres server, set the following files and then restart the server.

  •   add listen address to data/postgresql.conf
       For example: listen_addresses= '\*'
  •   add host to data/pg_hba.conf
       For example:  host all all 192.1.1.1/32 trust
  •   restart server by "postmaster -D ./data"

Step 2, Setup Rails Application

  1. gems install

     1.1 install rails 1.2.3 and related gems.

     1.2 install ruby-postgres-0.7.1.2006.04.06 if you get any errors in installation, pay attention to the rbconfig.rb
on ruby/1.8/lib/ruby/1.8/sparc-solaris2.11, which initialize the environment for ruby.

      The ruby-postgres-0.7.1.2006.04.06 is made by gcc, there're incompatible options for sun studio, so I install the gem manually.

  •   gem install ruby-postgres-0.7.1.2006.04.06
  •   cd /var/ruby/1.8/gem_home/gems/ruby-postgres-0.7.1.2006.04.06
  •   ruby extconf.rb --with-pgsql-dir=/usr/postgres/8.2
  •   Modify the Makefile created by ruby, remove the incompatible options such as -Wall
  •   make
  •   make install
  •   checked by irb
        -bash-3.2# irb
        irb(main):001:0> require 'postgres'
        => true

    1.3 you can get more detail info by install mongrel related gems.

  2.  Download and start the Application(regperf-j1.tar).

     -bash-3.2$  tar xvf regperf-j1.tar

     -bash-3.2$  cd regperf

     -bash-3.2$  ./script/server

    Notes: the page info are located in regperf/public.

    If the postgres server is set remote, we should change config/database.yaml to set remote server, for example:

    development:

       adapter: postgresql

       database: regperf

       username: damien

       password:

       host:   remote_server

  3.  Pointing the web browser to localhost:3000/subscription the check the application. 

 Step 3, Setup Faban and the Faban Regperf driver

  1.  Download the Faban bundle by http://faban.sunsource.net/.

  2.  Set FABAN_HOME and JAVA_HOME.

  3.  Download the FABAN driver for Rails from  Damien's blog and unjar it into $FABAN_HOME/samples.

      Here I made a lot of modifications and rebuild the regperf-rails by myself.

      3.1  modify the source code in reperf-rails/src/regperf/driver.

  •   For Loader1.java, change subscriptions to subscription
  •   For RailsDriver.java, change subscriptions to subscription
  •   For RailsDriver.java, change the function getSubscriberFromPage           

        Change the line from :
        String idstr = sb.substring(match.start()+20, match.end()-2);
        to:
        String idstr = sb.substring(match.start()+19, match.end()-2);
        otherwise idstr will get null if the index is less than 10.

      3.2  rebuild by ant.

Step 4, Running the performance using the Rails runtime 

    1. Edit the regperf-rails/config/run.xml

  • Change the value of basepath from subscriptions to subscription
  • change the value of outputDir to match your $FABAN_HOME/output directory
  • change the value of host for serverConfig for remote rails application server
  • modify the number of simulated users by changing the value of <scale>1<scale>

   You will get 10 users for each scale factor e.g. scale 1 will give 10 simulated users
   Note the number of loadedsubscribers should match the number of rows you load into the database (this is set initially to 100)
   Refer to the Faban documentation for other values to change in the run.xml

  2. -bash-3.2$  cd reperf-rails/sbin

  3. you can change the number of loader then run ./loader.sh

      If the rails application server is set remote, we should change the address in loader.sh
           
  4. start the rmiregistry (this runs in the background)

        -bash-3.2$  ./registry.sh &

  5. start and execute the benchmark

        -bash-3.2$  ./master.sh

    Starts up all of the simulated users and writes results of the run into $FABAN_HOME/output/xx directory.
    The results can be conveniently viewed with a web browser.


Reference:

  •  http://blogs.sun.com/damien/
  •  http://blogs.sun.com/tomdaly/
  •  http://tekgrrl.uk/twiki/bin/view/Training/RegperfFabanSetupNotes
  •  http://rubyforge.org/top/toplist.php?type=downloads
  •  http://faban.sunsource.net/



bugs in generating ri for ruby

Ruby can generate documents for all the ruby libraries automatically, which include html and ri.

Bug description

When we integrate ruby into solaris nv, it's found that the ri files generated by ruby will differ in different machines, some yaml files lost in building, which make nightly build failed when making package for SUNWruby18u, see as following:

Files missing from packages:


T                           File Name                                                  Reloc/Sym name       perm owner group inode lnk maj min package(s)
------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
f usr/ruby/1.8/share/ri/1.8/system/IRB/WorkSpace/__evaluate__-i.yaml                 -      644     -      -      0      1      -      -    proto

f usr/ruby/1.8/share/ri/1.8/system/IRB/Context/_set_last_value-i.yaml                    -      644     -      -      0      1      -      -    proto

f usr/ruby/1.8/share/ri/1.8/system/WEBrick/HTTPRequest/orig_parse-i.yaml          -      644     -      -      0      1      -      -    proto

f usr/ruby/1.8/share/ri/1.8/system/WEBrick/HTTPRequest/orig_meta_vars-i.yaml   -      644     -      -      0      1      -      -    proto

f usr/ruby/1.8/share/ri/1.8/system/WEBrick/HTTPRequest/orig_parse_uri-i.yaml     -      644     -      -      0      1      -      -    proto

Research

"Yet Another Multicolumn Layout" (YAML) is an (X)HTML/CSS framework for
creating modern and flexible floated layouts. And it's used by ruby for documents, it seems each yaml file stands for a ruby method.

1) Looking into the files missed in package, and we will find all the lost files stand for alias methods.
For example, usr/ruby/1.8/share/ri/1.8/system/IRB/Context/_set_last_value-i.yaml
, the method _set_last_value is defined in lib/irb/ext/history.rb

module IRB
  class Context
    NOPRINTING_IVARS.push "@eval_history_values"
    alias _set_last_value set_last_value
    def set_last_value(value)

      _set_last_value(value)
      ...
    end
...

But some alias methods generate yaml files successfully, such as alias method _setup_maker_element in lib/rss/2.0.rb.

2) Looking at the source code of generating ri for each method, we find that for alias, it will determine if the prototype has defined before alias.(see parse_rb.rb)

That's why some ri files for alias methods not generated in building, ruby don't find the prototype method, so these alias are ignored in ri generation.

3) The prototype of lost alias method are defined in several files, for example the prototype method of _set_last_value is set_last_value, it's defined in both lib/irb/ext/history.rb and lib/irb/context.rb. If ruby process lib/irb/context.rb fist, set_last_value will marked as method first, when it come to _set_last_value, ruby will look it as alias of set_last_value, and make ri for it, but the fact is history.rb is analyzed first, so _set_last_value is ignored.( See parse_rb.rb)

So the sequence of analyzing ruby libraries is the key point of the problem. 

4) Generally Ruby analyze libraries according to the file ".document", it read ".document" in its home directory, it determines which files or directories will be read next. Without the file ".document", ruby will read all the files and directories under it, and the reading sequence is defined by the inode number.(see rdoc.rb, dir.c)

The lost alias are located in those directories without the file ".document", so files are read according to the inode number, which may not the consequence we expected.

Suggestion

1) The best way for this problem is to add ".document" to all the directories. The only problem is there are lots of directories in ruby, and grow quickly.  

2) If the alias method is not important enough, we can sort those directories without ".document" before analyzing, maybe the sequence is not as good as expected, but it will be unique in different machine. (rdoc.rb)

 

Wednesday Apr 02, 2008

Source code changed for making ruby package integration to solaris nv


Two packages for ruby will be integrated into solaris nv79(maybe nv78) soon, which are SUNWruby18u and SUNWruby18r.

Package Content

  • The main contents for SUNWruby18u are ruby 1.8.6 and rubygems 0.9.4 which include
extensions: readline 5.2 (static link)
ruby 1.8.6 p110, with extensions readline, ssl, curses and tk
rubygems 0.9.4
  • And the gems repository are put in SUNWruby18r by setting GEM_HOME as /var/ruby/1.8/gem_home, so people can install different gems in different zones.
Source code changed for solaris
  For extension readline-5.2
  •     readline-5.2/Makefile.in:  which will cause error if original file don't exist
  •  Add testing if history.a exist in target dir before mv it to history.old
  •  Add testing if readline.a exist in target dir before mv it to readline.old
  •     readline-5.2/doc/Makefile.in: which will cause error in makeinfo
  •  change "MAKEINFO = LANGUAGE= makeinfo" to "MAKEINFO = makeinfo"
  For ruby-1.8.6 
  •     ruby-1.8.6/ext/Setup   :  Set readline as static library.
  •     ruby-1.8.6/ruby.1         :  Change the ruby path to /usr/bin/ruby
  •     ruby-1.8.6/Makefile.in :  Delete ".DEFAULT : all" in Makefile which will cause Warning in nightly build

  For rubygem-0.9.4  
    rubygem-0.9.4/lib/rubygems.rb : Add /var/ruby/1.8/gem_home to defaule home directory path so people can use it without setting GEM_HOME in environment.

    See as followed:
   
# Default home directory path to be used if an alternate value is
    # not specified in the environment.
    def default_dir
      if defined? RUBY_FRAMEWORK_VERSION
        return File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems" )
      else
        File.join(Config::CONFIG['libdir'], 'ruby', 'gems', Config::CONFIG['ruby_version'])
        #########################################################
        # add for solaris 2.11 packages SUNWruby18u & SUNWruby18r
        # as the GEM_HOME is set to be /var/ruby/1.8/gem in setup
        # we add it as the default home directory for the running environment
        File.join('/var/ruby/1.8/gem_home')
      end
    end


Build ruby1.8.6 and Ruby 1.9.0 on Solaris 11 by studio 12

[Problem]

An error occurred in building ruby 1.8.6(released version of ruby) on Solaris nv by sun studio 12, show as following:

cc -g -I. -I.ext/include/i386-solaris2.11 -I./include  -DRUBY_EXPORT  -c
./missing/isinf.c 

"./missing/isinf.c", line 31: syntax error before or at: __builtin_isinf
cc: acomp failed for ./missing/isinf.c 

[Resolution]

As isinf is part of libm – isinf(3M) in Solaris, file isinf.c is not needed in compiling ruby, but ruby just account it for Solaris10, so we should add support to latest Solaris version in configure.in.

Solaris\*2.10)  if test -z "$GCC"; then         
                          ac_cv_func_isinf=yes 
                       fi                      
                       LIBS="-lm $LIBS"        
                       ;;                      
Change into following:
Solaris\*2.1\*)  if test -z "$GCC"; then         
                          ac_cv_func_isinf=yes 
                       fi                      
                       LIBS="-lm $LIBS"        
                       ;;                      

Now the bug is send back to the Ruby Community and got fixed in the latest ruby version 1.9.0.

[Detail Compiling Step]

Step 1: Setup the environment of Solaris 11(for example, snv_71 X86)

  1. Installed Sun Studio 12
     
    Sun Studio 12 is free in http://developers.sun.com/sunstudio/downloads/index.jsp

  1. Following packages with related packages are installed in system
     
    autoconf-2.6.0 / automake-1.10 / subversion-1.4.4 /...

  1. Set the PATH
    export PATH=/opt/SUNWspro/bin:/usr/local/bin:/usr/ccs/bin:$PATH:.
    export MANPATH=/opt/SUNWspro/man:$ MANPATH

Step 2: Download the source code

For Ruby 1.8.6 :  The released version is ready in ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6.tar.gz

For latest Ruby version: The latest version can be get from Nightly Snaphot or by subversion, see as followed.
   
$ svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
   If your computer is behind a proxy, edit your "servers" configuration file to indicate which proxy to use.
   For example, add proxy info(webcache.sfbay.sun.com:8080) to configuration file
       $ vi /.subversion/server

[global]   
# http-proxy-exceptions = \*.exception.com, www.internal-site.org
# http-proxy-host = defaultproxy.whatever.com 
# http-proxy-port = 7000  
   ...                      
# ssl-authority-files = /path/to/CAcert.pem;/path/to/CAcert2.pem
http-proxy-host = webcache.sfbay.sun.com 
http-proxy-port = 8080    

Step 3: Building ruby

  1. If it's ruby 1.8.6, change the “configure.in” first as mentioned.

  2. Check if script file “configure” is ready, otherwise run autoconf to make it.
    $ autoconf

  1. Run the configure script.
      $ configure --without-gcc

  2. Next, run make.
    $ make
    If you met an error like followed, just make again.
       
    \*\*\* Error code 1
        The following command caused the error:
        { \\
            echo "all:; -@rm -f conftest.mk"; \\
            echo "conftest.mk: .force; @echo AUTO_REMAKE"; \\
            echo ".force:"; \\
        } > conftest.mk || exit 1; \\
        make -f conftest.mk | grep '\^AUTO_REMAKE$' >/dev/null 2>&1 || \\
        { echo "Makefile updated, restart."; exit 1; }
         make: Fatal error: Command failed for target `Makefile'

  3. Finally, run "make install", and ruby, rdoc, and irb will be installed into /usr/local/bin
    $ make install
    BTW, if you're building ruby 1.9.0, please install ruby 1.8.6 before it.

[See also]

About

Xiao-Song Chris Zhu

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today