Installing under HP-UX

Hello Ruby Experts,

I am new to Ruby, and already struggle with the installation
before even having written a single line of Ruby code.

Since I have been programming in Perl for a while
I found what I have read so far about Ruby syntax and idioms
quite tangible, so that the transition shouldn’t be too dificult.

I know I should start exploring Ruby maybe from a Linux box
where most likely all packages already came with any recent distro.

However, I need to write a SOAP client (sounds like hubris for a Ruby
newbie?)
that needs to be run from an HP-UX box.

Since there are no recent prebuilt ports of Ruby for HP-UX,
and since I am in the lucky position to have the HP ansic compiler
available at this box, I downloaded the latest stable source tarball.

I already had installed binaries of zlib and OpenSSL that also were
built
with the ansic compiler, albeit not in the usual places where I guess
Ruby
would look for them.
But the autoconf --help options didn’t reveal any mention of these libs.
So I ran a plain ./configure and afterwards make.
At this point make used to abort when compiling some openssl config
function.
Obviously because the HP ansic compiler is only C89 aware while in the
said
function a post-C89 array assignment took place.
So I needed to spread the asignment to two lines,
and the make finished without further errors.
(maybe the Ruby maintainers could add a note or patch for other plagued
HP users?)

diff ext/openssl/ossl_config.c{,.dist}

248,251c248
< VALUE arg[2];
< /arg = { self, section };/
< arg[0] = self;
< arg[1] = section;

VALUE arg[2] = { self, section };

My Ruby build seems to work, so does the irb interpreter

$ which ruby
/usr/local/bin/ruby

$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [hppa2.0w-hpux11.11]

Being used to Perl I do miss the -V which for perl displays the whole
build details.

Also being pampered somewhat by perldoc I do miss comparable Ruby Howtos
similar to what a “perldoc perl” has to offer.
This would be a tremendous help getting into Ruby by such a quickref
without having to peruse programming tomes in paper.

Still, I am unaware how the whole packaging/module system of Ruby
is organized.

I read somewhere that the CPAN equivilant were the Ruby Gems.
So I downloaded their tarball (you couldn’t download the whole CPAN that
easily)
and ran as root the setup.rb script.

But something must have gone awry.

When I now want to query gem how it is invoked
I get this mess.

$ gem --help
/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:4:in
require': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:4 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8:inrequire’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:504:in
require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:504 from /usr/local/bin/gem:9:inrequire’
from /usr/local/bin/gem:9

Looks as if it cannot find the location of the libz* files.
How can I fix this?

My next target would be to get Rails installed and running.
Anything similar there to watch out for?

Regards

Hi,

At Fri, 13 Jul 2007 22:17:13 +0900,
Ralph G. wrote in [ruby-talk:259306]:

Obviously because the HP ansic compiler is only C89 aware while in the
said
function a post-C89 array assignment took place.

I’ve thought that it is a part of C89, isn’t it?

Nobuyoshi N. wrote:

Hi,

At Fri, 13 Jul 2007 22:17:13 +0900,
Ralph G. wrote in [ruby-talk:259306]:

Obviously because the HP ansic compiler is only C89 aware while in the
said
function a post-C89 array assignment took place.

I’ve thought that it is a part of C89, isn’t it?

Hi Nobuyoshi,

yes, the HP ansic is C89, but the expression it couldn’t deal with,
was C99 or something newer than C89 as I was told by a C hacker.
I was also told that according to C89 it wasn’t allowed to assign
variables as values in a multi-value array assignment within curly
braces.
Sorry, I am no C hacker to confirm this.
Anyway, the single line assignments by indeces was a functioning
work-around.

But this problem has been solved.

What bothers me now is my obviously broken Gems installation.
Do you have any idea how I can mend it so that the path to the zlib
library files is found?

Do Ruby Gems have a central configuration file
similar to the Config.pm file in $Config{installprivlib}/CPAN/Config.pm
of a Perl installation?

With Perl this is quite a handy $CPAN::Config hashref that contains all
the details required for management of the local CPAN repository.
For instance, since I am sitting in a shielded LAN I am required to send
my HTTP/FTP requests to the Internet via a proxy.
The $CPAN::Config hashref provides key value pairs for the proxy’s URL
and authentication credentials etc.

Where would I store this an other information in Ruby Gems so that
installations of Gems from an Internet repository would work for me?

Hi,

At Mon, 16 Jul 2007 14:44:55 +0900,
Ralph G. wrote in [ruby-talk:259895]:

yes, the HP ansic is C89, but the expression it couldn’t deal with,
was C99 or something newer than C89 as I was told by a C hacker.
I was also told that according to C89 it wasn’t allowed to assign
variables as values in a multi-value array assignment within curly
braces.

Do you mean Compound Literal by the latter? Yes, it’s C99, and
Designated Initializer too.

But this problem has been solved.

Can’t you explain how you’ve done?

What bothers me now is my obviously broken Gems installation.
Do you have any idea how I can mend it so that the path to the zlib
library files is found?

I’m not sure about Gems, but zlib is one of bundled extension
libraries. You can use --with-zlib-dir (or --with-zlib-include
and --with-zlib-lib) configure option.

Hi,

At Mon, 16 Jul 2007 19:37:29 +0900,
Ralph G. wrote in [ruby-talk:259944]:

Can’t you explain how you’ve done?

But I did.
See the diff between the original ossl_config.c.dist (as came in the
ruby tarball)
and my modified ossl_config.c

I thought if you found another way.

I’m not sure about Gems, but zlib is one of bundled extension
libraries. You can use --with-zlib-dir (or --with-zlib-include
and --with-zlib-lib) configure option.

Actually, I was looking for these flags before I ran configure
within the untarred ruby dir.
But it never gave any remotest clue, see

It is just ignored by configure itself, but passed to
ext/zlib/extconf.rb via dir_config(“zlib”) call.
Or, you can pass it as CONFIGURE_ARGS environment variable.

This would mean I have to deinstall my Ruby build completely,
and run make distclean and ./configure --with-zlib-dir
/opt/iexpress/zlib/lib
again?

You don’t need to make distclean. Just remove
ext/zlib/Makefile, and run make as:

env CONFIGURE_ARGS=–with-zlib-dir=/opt/iexpress/zlib/lib make

and previosly installed files will be overwritten.

Btw, will an

rm -rf /usr/local/lib/ruby

suffice, or is there a better way of deinstallation?

The file .installed.list should contains the list of installed
files.

sudo xargs rm -f < .installed.list

or, if you used DESTDIR to install:

sed “s|^|$DESTDIR|” .installed.list | sudo xargs rm -f

Nobuyoshi N. wrote:

Can’t you explain how you’ve done?

But I did.
See the diff between the original ossl_config.c.dist (as came in the
ruby tarball)
and my modified ossl_config.c

I’m not sure about Gems, but zlib is one of bundled extension
libraries. You can use --with-zlib-dir (or --with-zlib-include
and --with-zlib-lib) configure option.

Actually, I was looking for these flags before I ran configure
within the untarred ruby dir.
But it never gave any remotest clue, see

uname -srv;pwd

HP-UX B.11.11 U
/usr/local/tmp/ruby-1.8.6

./configure --help 2>&1 | grep -ic zlib

0

I have got on this box installed an ansic built zlib that HP
distribute as part of their Internet Express Open Source ports.
The relevant files are located here

swlist -l file ixZlib|grep libz

ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/libz.a
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/libz.sl
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/libz.sl.1
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/libz.sl.1.2.3
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/pa20_64/libz.a
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/pa20_64/libz.sl
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/pa20_64/libz.sl.1
ixZlib.Zlib.ZLIB-LIB: /opt/iexpress/zlib/lib/pa20_64/libz.sl.1.2.3

This would mean I have to deinstall my Ruby build completely,
and run make distclean and ./configure --with-zlib-dir
/opt/iexpress/zlib/lib
again?

Btw, will an

rm -rf /usr/local/lib/ruby

suffice, or is there a better way of deinstallation?

Hi unknown,

many thanks for your helpful hints.

unknown wrote:

You don’t need to make distclean.

It looks as if I executed the distclean a bit prematurely already.

The file .installed.list should contains the list of installed
files.

sudo xargs rm -f < .installed.list

Thus the .installed.list doesn’t contain any useful information anymore:

cat .installed.list

/usr/local/share/man/man1/
/usr/local/share/man/man1/ruby.1

Just remove ext/zlib/Makefile, and run make as:

env CONFIGURE_ARGS=–with-zlib-dir=/opt/iexpress/zlib/lib make

Actually, this didn’t seem to be necessary.
My ordinary

./configure --with-zlib-dir=/opt/iexpress/zlib

–with-openssl-dir=/opt/openssl/0.9.7

from the ruby source top level dir seems to have conveyed my intention
even to ruby zlib’s own Makefile

grep -n iexpress ext/zlib/Makefile

46:CPPFLAGS = -DHAVE_ZLIB_H -DOS_CODE=OS_UNIX
-I/opt/iexpress/zlib/include
71:libpath = $(topdir) /opt/iexpress/zlib/lib
72:LIBPATH = -L"$(topdir)" -L"/opt/iexpress/zlib/lib"

It is just ignored by configure itself, but passed to
ext/zlib/extconf.rb via dir_config(“zlib”) call.
Or, you can pass it as CONFIGURE_ARGS environment variable.

So it instead didn’t ignore these args despite your assumption.

I just would like to complain why they simply don’t mention these
configure flags in the --help dump?

An INSTALL file is missing and the README is pretty concise.

Ruby folks don’t seem to be any less esoteric than the Perl folks,
contrary to subdued TIMTOWTDI adherence.

and previosly installed files will be overwritten.

Ok, this is common unspoken Unix consent.

So I simply reissue

make install

./miniruby ./instruby.rb --dest-dir=“” --extout=“.ext”
–make=“/usr/local/bin/gmake” --mflags=“” --make-flags=“”
–installed-list .installed.list --mantype=“man”
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts

Ah, now this file also contains something more meaningful

wc .installed.list

659 659 28569 .installed.list

and the RDoc (which takes quite a while to parse all the ruby code)

make install-doc

After that I cd-ed back to the rubygems tree,
and reran as root

ruby setup.rb

… loads of output …

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a
while)…
…done.
No library stubs found.

Well, at least this time I’m not yet getting the errors about unloadable
zlib.

gem -v

0.9.4

gem list --local

*** LOCAL GEMS ***

sources (0.0.1)
This package provides download sources for remote gem installation

Hm, I now wonder how I am supposed to configure my Gems installation
to use our Internet proxy,
or does it understand the same environment like wget or LWP and
vars such as http_proxy, no_proxy, proxy_user, proxy_passwd?

So far gem only knows about this

gem environment

RubyGems Environment:

  • VERSION: 0.9.4 (0.9.4)
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  • GEM PATH:
    • /usr/local/lib/ruby/gems/1.8
  • REMOTE SOURCES:

Ralph G. wrote:

I’ve just discovered the gem_server binary
and started this Gem webserver.
Let’s see if I will find an answer to my Gems config question there…?

Ugh, this doesn’t work right away
(of course, did I use the real values of our proxy)

gem list -r -p http://proxy_user:[email protected]:proxy_port
ERROR: While executing gem … (NoMethodError)
undefined method `[]=’ for #Gem::ConfigFile:0x4039ec90

But at least it does give a hint of some Gem::ConfigFile.

Let’s see if I can find it

find /usr/local/lib/ruby -name *ConfigFile*

/usr/local/lib/ruby/gems/1.8/doc/rubygems-0.9.4/ri/Gem/ConfigFile
/usr/local/lib/ruby/gems/1.8/doc/rubygems-0.9.4/ri/Gem/ConfigFile/cdesc-ConfigFile.yaml
/usr/local/lib/ruby/gems/1.8/doc/rubygems-0.9.4/rdoc/classes/Gem/ConfigFile.src
/usr/local/lib/ruby/gems/1.8/doc/rubygems-0.9.4/rdoc/classes/Gem/ConfigFile.html

Hm, this rather seems to be some class definition
(forgive my blind poking, I am totally new to Ruby)

ri Gem::ConfigFile

------------------------------------------------- Class: Gem::ConfigFile
Store the gem command options specified in the configuration file.
The config file object acts much like a hash.


Class methods:

 new

Instance methods:

 [], config_file_name

Attributes:
args, backtrace, verbose

See if I can call the config_file_name method?
Hope it is a getter as well…

ruby -r rubygems -r Gem::ConfigFile -e 'f=Gem::ConfigFile.new;puts

f.config_file_name()’
ruby: no such file to load – Gem::ConfigFile (LoadError)

Rather seems to be a setter which is expecting some filename to pass?

What does the [] try to imply in the Instance methods: section?
I would take it as an empty list aka array (in Perl it would be an
anonymous array ref).
Can one use this thingy somehow as a method call?

Hi,

At Wed, 18 Jul 2007 17:58:57 +0900,
Ralph G. wrote in [ruby-talk:260415]:

It is just ignored by configure itself, but passed to
ext/zlib/extconf.rb via dir_config(“zlib”) call.
Or, you can pass it as CONFIGURE_ARGS environment variable.

So it instead didn’t ignore these args despite your assumption.

I just would like to complain why they simply don’t mention these
configure flags in the --help dump?

Because configure doesn’t take care of such unknown flags, but
simply stores them in config.status file, as is. It doesn’t
mention flags about which it knows nothing, of course.

I’ve just discovered the gem_server binary
and started this Gem webserver.
Let’s see if I will find an answer to my Gems config question there…?

Nobuyoshi N. wrote:

Hi,

At Wed, 18 Jul 2007 17:58:57 +0900,
Ralph G. wrote in [ruby-talk:260415]:

It is just ignored by configure itself, but passed to
ext/zlib/extconf.rb via dir_config(“zlib”) call.
Or, you can pass it as CONFIGURE_ARGS environment variable.

So it instead didn’t ignore these args despite your assumption.

I just would like to complain why they simply don’t mention these
configure flags in the --help dump?

Because configure doesn’t take care of such unknown flags, but
simply stores them in config.status file, as is. It doesn’t
mention flags about which it knows nothing, of course.

Hi Nobuyoshi,

Ok, I don’t bother about configure oddities anymore
because my new compile run of ruby and the subsequent execution
of the Gem’s setup.rb script seems to have worked.

Although I started gem_server and connected my browser to port 8808
I couldn’t find any useful information where this repository stores its
configuration.

As already mentioned my -p proxy specifications with any gem command
that goes for a remote repository by -r also failed.
Note, I need to authenticate with our proxy, and it obviously rejects
anything in the common URL format like
http://proxy_user:proxy_pass@proxy_url:proxy_port.
With Perl I have a highly tunable LWP class where probably are dozens of
ways to pass authentication credentials, even if it required overriding
some method.
With such a hyped and acclaimed web development language as Ruby I
cannot beleive that there isn’t something similar available.
But usually the books only mention the standard cases.

Besided, are there other recommendable, and more frequented Ruby forums
where dummies like me can ask (Ruby) beginners’ questions?