Where's my Ruby?

OpenSolaris is different from Solaris Expresses(ie., the SXCE and SXDEs) in that most of the software that comprises this release is not distributed in the CD media(or image that can be downloaded from opensolaris.com).

There's just one CD, and rest of the packages that comprise OpenSolaris are hosted on pkg.opensolaris.org, and available through the "/usr/bin/pkg" command.

Ruby is not on the base CD image, but to have a usable version of Ruby on OpenSolaris 2008.05 is very easy, just issue the following commands.

-bash-3.2#pkg install SUNWruby18

DOWNLOAD PKGS FILES XFER (MB)

Completed 1/1 1546/1546 8.50/8.50


PHASE ACTIONS

Install Phase 1844/1844

-bash-3.2# which ruby

/usr/bin/ruby

-bash-3.2#pkg install SUNWgcc

DOWNLOAD PKGS FILES XFER (MB)

Completed 4/4 2035/2035 88.13/88.13


PHASE ACTIONS

Install Phase 2457/2457

-bash-3.2#cd /usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11

-bash-3.2#mv rbconfig.rb rbconfig.rb.orig

-bash-3.2#wget http://blogs.sun.com/prashant/resource/gcc/rbconfig.rb


After this point, one is set to install Ruby applications with C extensions . . . like Mongrel or Thin.

Comments:

What is the command that you use to discover that the package name is "SUNWruby18"?

Posted by Tim on June 02, 2008 at 08:26 AM PDT #

Tim,

Uttering "pkg search -r ruby" will bring up matches for Ruby in the OpenSolaris repository.

-bash-3.2# pkg search -r ruby
INDEX ACTION VALUE PACKAGE
basename dir usr/netbeans/ruby1/ruby pkg:/SUNWlibnb-ruby1@6.0.1-0.86
basename dir usr/netbeans/ruby1/ruby pkg:/SUNWlibnb-ruby1@6.0.1-0.86
basename dir usr/netbeans/ruby1/ruby pkg:/SUNWlibnb-ruby1@6.0.1-0.86
basename file usr/ruby/1.8/bin/ruby pkg:/SUNWruby18@1.8.6-0.86
basename file usr/ruby/1.8/bin/ruby pkg:/SUNWruby18@1.8.6-0.86
basename link usr/bin/ruby pkg:/SUNWruby18@1.8.6-0.79
basename dir usr/netbeans/ruby1/ruby pkg:/SUNWlibnb-ruby1@6.0.1-0.86

Posted by Prashant Srinivasan on June 02, 2008 at 09:43 AM PDT #

Prashant,

I have followed your instructions above.
I viewed the file
http://blogs.sun.com/prashant/resource/gcc/rbconfig.rb
and I see references to the package /opt/SUNWspro.40

I do not have this package installed. What is this package part of? DO I need to install it?
I performed a search and it seems to be part of Sun Studio??

Any suggestions?

Thanks.

Gisella

Posted by Gisella Saavedra on June 13, 2008 at 09:02 AM PDT #

Gisella,

This should not cause you any trouble, and can be safely ignored.

The reference is to the environment that was used to build Ruby. This path is not used in any operation that pertains to gems or ruby package build.

This is an artifact of how the Ruby implementors decided to store data about the compiler that Ruby was compiled with . . . I don't believe that it is as useful in an environment where Ruby binaries are directly made available.

Posted by Prashant Srinivasan on June 13, 2008 at 11:50 AM PDT #

After I follow your instructions,
I tried to install the gem rmagick and I am getting a gcc compiler error.

It seems to be looking for Sun Studio gcc.

This is the error I get

"/usr/sfw/bin/gcc -E -I. -I/usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11 -I. -I/usr/include -xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all -D_REENTRANT conftest.c -o conftest.i"
gcc: unrecognized option `-Xa'
gcc: language c99=all not recognized
gcc: conftest.c: linker input file unused because linking not done
checked program was:
/\* begin \*/
1: #include <stdint.h>
/\* end \*/

==============================

Checking on ImageMagick configuration:

# convert -list configure

Path: /usr/lib/ImageMagick-6.3.4/config/configure.xml

Name Value
-------------------------------------------------------------------------------
CC /opt/SUNWspro.40/SS11/bin/cc
CFLAGS -xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all -D_REENTRANT
CONFIGURE ./configure /usr/share/config.site /usr/etc/config.site
COPYRIGHT Copyright (C) 1999-2007 ImageMagick Studio LLC
CPPFLAGS -I/usr/include
CXX /opt/SUNWspro.40/SS11/bin/CC
CXXFLAGS -xO3 -D_REENTRANT
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib dps fontconfig freetype jpeg png rsvg tiff x11 xml zlib
DISTCHECK_CONFIG_FLAGS 'CC=/opt/SUNWspro.40/SS11/bin/cc' 'CFLAGS=-xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all ' 'CPPFLAGS=-I/usr/sfw/include -I/usr/include/libxml2 -I/usr/sfw/include/freetype2 -I/usr/sfw/include -I/usr/include/libxml2 -I/usr/sfw/include/freetype2 -I/usr/X/include/X11' 'CXX=/opt/SUNWspro.40/SS11/bin/CC' 'LDFLAGS=-L/usr/lib -L/usr/sfw/lib -L/usr/sfw/lib -L/usr/X/lib -R/usr/sfw/lib:/usr/X/lib' --disable-deprecate --with-quantum-depth=16 --with-fpx=no --with-fontpath=
EXEC-PREFIX /usr
HOST i386-pc-solaris2.11
LDFLAGS -L/usr/lib -L/usr/lib -L/usr/sfw/lib -L/usr/sfw/lib -L/usr/X/lib -R/usr/sfw/lib:/usr/X/lib -L/usr/openwin/lib -R/usr/openwin/lib -lfreetype
LIB_VERSION 0x634
LIB_VERSION_NUMBER 6,3,4,2
LIBS -lMagick -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lsocket -lnsl -lXt -lbz2 -lz -lpthread -lm -lpthread
NAME ImageMagick
PCFLAGS
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 03/19/08
VERSION 6.3.4
WEBSITE http://www.imagemagick.org

====================

It seems to not use the SUNWgcc gcc.

Do I need to change my PATH to point to SUNWgcc? I do not know what to do now. Please advise.

Posted by guest on June 16, 2008 at 06:52 AM PDT #

It seems like ImageMagick is configured to expect the Sun Studio compiler flags, and a compiler location that does not exist.

gem is using gcc to compile your rmagick extension, and gcc does not recognize the -Xa and -xc99=all flags.

So you have two ways of proceeding, the easiest is to remove the offending flags in your ImageMagick configuration.xml and try again.

The more round about option is to install the Sun Studio compilers, change the paths in your ImageMagick configuration.xml to point to the correct Sun Studio location, download the rbconfig.rb for Sun Studio, and then build your gem . . .

Posted by Prashant Srinivasan on June 16, 2008 at 07:25 AM PDT #

Will it help if I just uninstall the package sunstudioexpress?

I do not know which package installed ImageMagick because I did not install it.

I will probably still need to fix some paths??

Posted by guest on June 16, 2008 at 07:41 AM PDT #

Your problem is related to the entries in ImageMagick's configuration.xml that point to Sun Studio compiler flags. If you don't want to remove those the "-Xa" and the "-xc=99" entries(or cannot, for some reason), then you could try the below strategy.

1. link /opt/sunstudioexpress to /opt/SUNWspro
2. link /opt/sunstudioexpress to /opt/SUNWspro.40
3. obtain the rbconfig.rb for Sun Studio from http://blogs.sun.com/prashant/resource/sun_studio/rbconfig.rb and replace that with your default rbconfig.rb
4. Try installing the gem again.

Posted by Prashant Srinivasan on June 16, 2008 at 08:01 AM PDT #

I removed all instances of the flags -Xa & -xc=99
from the file

/usr/lib/ImageMagick-6.3.4/config/configuration.xml

but when I do gem install rmagick,

I get the same error and the .log file still shows the flags Xa and xc=99.

I don't know where it is picking them up from.
Maybe I cannot just edit the configuration.xml file but I have to issue a command on ImageMagick.

Posted by guest on June 16, 2008 at 08:38 AM PDT #

hmm . . .thats right. extconf.rb seems to call "Magick-config --cflags" . . . and that returns "-xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all -D_REENTRANT" which is a hard coded value.

So Magick-config is what needs to be changed . . .

Posted by Prashant Srinivasan on June 16, 2008 at 09:28 AM PDT #

I believe I got it to compile . . .here's the steps I had to take -

1. revert Magick-config to it's original state(with the Studio specific flags and all that).

2. make sure you have "sunstudioexpress" package installed.

3. wget http://blogs.sun.com/prashant/resource/sun_studio/rbconfig.rb and copy the rbconfig.rb into /usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11

4. create the following links:

ln -s /opt/SunStudioExpress /opt/SUNWspro
ln -s /opt/SunStudioExpress /opt/SUNWspro.40

5. "gem install rmagick" should do the trick.

Posted by Prashant Srinivasan on June 16, 2008 at 09:39 AM PDT #

Prashant,

I got a little further but I still have problems.

This is the error I get now:

--------------------

have_library: checking for InitializeMagick() in -lMagickCore... -------------------- no

"/opt/SUNWspro/bin/cc -o conftest -I. -I/usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11 -I. -I/usr/include -xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all -D_REENTRANT conftest.c -L'.' -L'/usr/ruby/1.8/lib' -R'/usr/ruby/1.8/lib' -L/usr/lib -L/usr/lib -L/usr/sfw/lib -L/usr/sfw/lib -L/usr/X/lib -R/usr/sfw/lib:/usr/X/lib -L/usr/openwin/lib -R/usr/openwin/lib -lfreetype -lMagick -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lsocket -lnsl -lXt -lbz2 -lz -lpthread -lm -lpthread -lWand -lMagick -lruby-static -lMagickCore -lpthread -ldl -lcrypt -lm -lc"
ld.so.1: ld: fatal: libld.so.4: version `SUNWprivate_4.2' not found (required by file /usr/bin/ld)
ld.so.1: ld: fatal: libld.so.4: open failed: No such file or directory
ld.so.1: ld: fatal: relocation error: file /usr/bin/ld: symbol ld32_main: referenced symbol not found
cc: Fatal error in /usr/ccs/bin/ld : Killed
checked program was:
/\* begin \*/
1: #include <assert.h>
2: #include <ctype.h>
3: #include <stdio.h>
4: #include <stdlib.h>
5: #include <math.h>
6: #include <time.h>
7: #include <stdint.h>
8: #include <sys/types.h>
9: #include <magick/MagickCore.h>
10:
11: /\*top\*/
12: int main() { return 0; }
13: int t() { void ((\*volatile p)()); p = (void ((\*)()))InitializeMagick; return 0; }
/\* end \*/

"/opt/SUNWspro/bin/cc -o conftest -I. -I/usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11 -I. -I/usr/include -xO3 -xarch=386 -xchip=pentium -xspace -Xa -xildoff -xc99=all -D_REENTRANT conftest.c -L'.' -L'/usr/ruby/1.8/lib' -R'/usr/ruby/1.8/lib' -L/usr/lib -L/usr/lib -L/usr/sfw/lib -L/usr/sfw/lib -L/usr/X/lib -R/usr/sfw/lib:/usr/X/lib -L/usr/openwin/lib -R/usr/openwin/lib -lfreetype -lMagick -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lsocket -lnsl -lXt -lbz2 -lz -lpthread -lm -lpthread -lWand -lMagick -lruby-static -lMagickCore -lpthread -ldl -lcrypt -lm -lc"
"conftest.c", line 13: prototype mismatch: 0 args passed, 1 expected
cc: acomp failed for conftest.c
checked program was:
/\* begin \*/
1: #include <assert.h>
2: #include <ctype.h>
3: #include <stdio.h>
4: #include <stdlib.h>
5: #include <math.h>
6: #include <time.h>
7: #include <stdint.h>
8: #include <sys/types.h>
9: #include <magick/MagickCore.h>
10:
11: /\*top\*/
12: int main() { return 0; }
13: int t() { InitializeMagick(); return 0; }
/\* end \*/

========================

I ran the following commands (which show some version incompatibility and I do not know what it means):

# cat /etc/motd
Sun Microsystems Inc. SunOS 5.11 snv_90 January 2008

# mcs -p /usr/ccs/bin/ld
/usr/ccs/bin/ld:

@(#)SunOS 5.11 snv_86 January 2008

Posted by guest on June 16, 2008 at 10:00 AM PDT #

Thats strange - a quick Google search revealed that this could be because of a live upgrade gone bad.

http://blogs.sun.com/sch/entry/a_not_quite_isochronous_upgrade

A clean upgrade/reinstall might help you here.

Posted by Prashant Srinivasan on June 16, 2008 at 10:38 AM PDT #

Prashant,

we unistalled sunstudioexpress and ruby-dev to try to redo everything. ImageMagick was unistalled.
We tried installing ImageMagick from source following guidelines at ImageMagick site, but get errors regarding the encoding UTF-8. Would you suggest some URL having guidelines for isntalling ImageMagick for OpenSolaris??

Posted by guest on June 17, 2008 at 05:07 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

prashant

Search

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