Google Групи вече не поддържа нови публикации или абонаменти в Usenet. Съдържанието за минали периоди остава видимо.

Ruby under Suse Linux

2 показвания
Преминаване към първото непрочетено съобщение

Mike Calder

непрочетено,
29.04.2004 г., 10:10:0829.04.04 г.
до
Hi.

I'm new to Ruby, and struggling; Ruby does not seem to be very easy to install
under Linux.

I can't use the Suse RPM package, as I want the functionality of FOX and
fxruby, and they aren't on the distro. So I installed Ruby, FOX, and fxruby
from the source tars. After several problems with the install process
(libraries didn't seem to go where Ruby assumes them to be), by adding links
and setting environment variables I have managed to get these working; I can
run trivial programs, and I get the GUI results expected.

The problems just start afresh when I try to add extension libraries, or even
run programs that need libraries that I think I have already installed.

For example, there are a couple of sample programs that require soap and html
parser functionality - I thought soap was part of the core, but I installed
it again in any case, and also installed the html parser stuff. The installs
run clean but the programs still give load errors.

I suspect the problem is where the library modules and files are expected to
be - I just can't sort it out; I've copied everything several times over in
every place I think they should be; I have multiple copies all the same
in ../ruby/1.8, ../ruby/site-ruby/1.8, in my home directory ../ruby/1.8
and ../ruby/site-ruby/1.8.

I've looked through various websites and documentation, and though there seems
a lot of it, it's not very well organised and after three days struggling I
can't find what I'm looking for; my questions are:

Where does ruby expect library and extension files to be? What are the rules?
Is there a single document that tells me how to sort this mess out?

Can anyone point me? Ruby seems to be so close to what I want but if it's
going to be like this all the time

--
Clear skies!
Mike Calder.


ts

непрочетено,
29.04.2004 г., 10:19:4129.04.04 г.
до
>>>>> "M" == Mike Calder <c...@phosco.com> writes:

M> I suspect the problem is where the library modules and files are expected to
M> be - I just can't sort it out; I've copied everything several times over in
M> every place I think they should be; I have multiple copies all the same
M> in ../ruby/1.8, ../ruby/site-ruby/1.8, in my home directory ../ruby/1.8
M> and ../ruby/site-ruby/1.8.

Well, the problem is that you must *not* manually copy the files.

First before installing a module, verify if it's not distributed with your
version of ruby. It's useless to have multiple versions of the same
extensions

Then read the file README.en (or ...) which come with the extension.

Generally there are 2 ways to install an extension

$ ruby extconf.rb
$ make
($ su)
# make install

or

$ ruby install.rb config
$ ruby install.rb setup
($ su)
# ruby install.rb install

Guy Decoux

Yuri Leikind

непрочетено,
29.04.2004 г., 10:26:1929.04.04 г.
до
On Thu, 29 Apr 2004 23:10:08 +0900
Mike Calder <c...@phosco.com> wrote:

> Hi.
>
> I'm new to Ruby, and struggling; Ruby does not seem to be very easy to install
> under Linux.
>
> I can't use the Suse RPM package, as I want the functionality of FOX and
> fxruby, and they aren't on the distro. So I installed Ruby, FOX, and fxruby
> from the source tars.

Just a hint : You didn't need to install Ruby from sources as you have a SuSE package.
To compile some extension with this Ruby package you just need to install Ruby
development package, it has suffixes 'dev' or 'devel' (depends on the distro) in
its name.

--
Best regards,
Yuri Leikind


Mike Z

непрочетено,
29.04.2004 г., 10:44:1529.04.04 г.
до

Generally that's true, but with SuSE the ruby package contains everything
you need to compile against it (they have -devel packages for other
software, though).

I've built my own ruby 1.8.1 rpms (as well as ruby-gnome), but I'm not a
fox user (to state it mildly), so there's not much more help I can offer.

Except to say that it is possible, and you'll probably learn a lot getting
it to work, so good luck. :)

Cheers,
Mike
--
Mike Z <zo...@wyer.org> - it's an apathy thing


Mike Calder

непрочетено,
29.04.2004 г., 10:48:4229.04.04 г.
до
I do read README and INSTALL files. I did the original installs in the
correct manner - ruby install.rb or config, make, make install, depending.

Once libraries are created though, and they are not where the executable
expects them to be, it's usually enough to copy them about; that's what I've
done.

I still need to know where Ruby expects these things to be, or how to specify
(preferably in a single place, once and for all) where it should look.

--
Clear skies!
Mike Calder.


ts

непрочетено,
29.04.2004 г., 10:57:5929.04.04 г.
до
>>>>> "M" == Mike Calder <c...@phosco.com> writes:

M> I still need to know where Ruby expects these things to be, or how to specify
M> (preferably in a single place, once and for all) where it should look.


Well, I don't understand : if you follow the instructions in the README
file, you'll not have a problem and ruby will automatically find it.

The only possibility that I see, is that you use one version of ruby to
make the installation and then try to use these extensions with another
version of ruby

Try to do

ruby -e 'p $LOAD_PATH'

and you'll see where ruby look to find the libraries

Guy Decoux

Mike Calder

непрочетено,
29.04.2004 г., 11:55:5529.04.04 г.
до
That's the information I wanted, thanks. At least the reason for failure has
now apparently changed.

ruby -e 'p $LOAD_PATH'

gives me:

["/usr/local/lib/ruby/site_ruby/1.8", "/usr/local/lib/ruby/site_ruby/1.8/
i686-linux", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8", "/
usr/local/lib/ruby/1.8/i686-linux", "."]

I have made sure that the files and extensions I'm using are in one or more of
these (actually, everything is just about everywhere). Presumably the search
sequence is as listed, and there really only needs to be one copy of
something in one of those? Or is there a distinction between them? I notice
that the i686-linux directories have binary libraries where the others have
ruby source, in general - is this a required split or just for convenience of
tracking?

I have

require 'html-parser'

and

class MyHTMLParser < HTMLParser

in a ruby script. I have made sure that html-parser.rb (a standard ruby
extension I downloaded and installed using ruby install.rb) is present (along
with the sgml-parser.rb it requires) in

usr/local/lib/ruby
usr/local/lib/ruby/1.8
usr/local/lib/ruby/site_ruby
usr/local/lib/ruby/site_ruby/1.8

Each copy is identical and contains the definition of 'HTMLParser'.

However, when I run my script I get

testhtml.rb:22: undefined superclass `HTMLParser' (TypeError)

The 'html-parser' is presumably now being found as I am no longer getting
LoadError messages, but the content (the definition of class 'HTMLParser')
is not being used by my code (actually cut and pasted from a standard
example).

So probably the problem has changed from me not having things in the right
place to not understanding how to use standard classes.

I'll give it another day.

--
Clear skies!
Mike Calder.


Mike Z

непрочетено,
29.04.2004 г., 12:03:1429.04.04 г.
до
Mike,

What #! line are you using in your script?

It sounds like all your ruby stuff has been installed in /usr/local/, but
your script is running the suse-supplied binary in /usr/bin.

Cheers,
Mike

--

ts

непрочетено,
29.04.2004 г., 12:05:5229.04.04 г.
до
>>>>> "M" == Mike Calder <c...@phosco.com> writes:

M> So probably the problem has changed from me not having things in the right
M> place to not understanding how to use standard classes.

Well, here what I've done with this version of ruby

svg% ruby -ve 'p $LOAD_PATH'
ruby 1.8.1 (2004-04-24) [i686-linux]
["/home/ts/local/r181/lib/ruby/site_ruby/1.8", "/home/ts/local/r181/lib/ruby/site_ruby/1.8/i686-linux", "/home/ts/local/r181/lib/ruby/site_ruby", "/home/ts/local/r181/lib/ruby/1.8", "/home/ts/local/r181/lib/ruby/1.8/i686-linux", "."]
svg%

svg% ruby install.rb
/formatter.rb -> /home/ts/local/r181/lib/ruby/site_ruby/formatter.rb
/html-parser.rb -> /home/ts/local/r181/lib/ruby/site_ruby/html-parser.rb
/sgml-parser.rb -> /home/ts/local/r181/lib/ruby/site_ruby/sgml-parser.rb
svg%

svg% ruby -rhtml-parser -e 'class MyHTMLParser < HTMLParser; end; p MyHTMLParser'
MyHTMLParser
svg%

Guy Decoux


Mike Calder

непрочетено,
29.04.2004 г., 12:52:0129.04.04 г.
до
Now I'm really confused. I thought, "what's a standard-ish sort of core class
that should work?" Looked in the first directory of the load path and found
Matrix - I assume that's part of core 1.8? That fails as well. String is
OK, but that's built-in.

So, my problem is that no classes other than built-in classes are working.
Hm.

RUBY> ruby -ve 'p $LOAD_PATH'
ruby 1.8.1 (2003-12-25) [i686-linux]


["/usr/local/lib/ruby/site_ruby/1.8", "/usr/local/lib/ruby/site_ruby/1.8/
i686-linux", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8", "/
usr/local/lib/ruby/1.8/i686-linux", "."]

RUBY> ruby -rhtml-parser -e 'class MyHTMLParser < HTMLParser; end; p
MyHTMLParser'
-e:1: undefined superclass `HTMLParser' (TypeError)

RUBY> ruby -rhtml-parser -e 'class MyHTMLParser < Matrix; end; p MyHTMLParser'
-e:1: undefined superclass `Matrix' (TypeError)

RUBY> ruby -rhtml-parser -e 'class MyHTMLParser < String; end; p MyHTMLParser'
MyHTMLParser


On Thursday 29 April 2004 17:05, ts wrote:
> >>>>> "M" == Mike Calder <c...@phosco.com> writes:
>
> M> So probably the problem has changed from me not having things in the
> right M> place to not understanding how to use standard classes.
>
> Well, here what I've done with this version of ruby
>

..

> svg% ruby -rhtml-parser -e 'class MyHTMLParser < HTMLParser; end; p
> MyHTMLParser' MyHTMLParser
> svg%
>
>
>
> Guy Decoux

--
Clear skies!
Mike Calder.


ts

непрочетено,
29.04.2004 г., 12:56:3029.04.04 г.
до
>>>>> "M" == Mike Calder <c...@phosco.com> writes:


RUBY> ruby -rhtml-parser -e 'class MyHTMLParser < Matrix; end; p MyHTMLParser'

M> -e:1: undefined superclass `Matrix' (TypeError)

Well, for this you need to require matrix.rb

svg% ruby -rmatrix -e 'class A < Matrix; end; p A'
A
svg%


Guy Decoux

Mike Calder

непрочетено,
29.04.2004 г., 13:53:1529.04.04 г.
до
Don't you hate it when you make stupid mistakes like that?

OK, when I did it properly, matrix worked fine, html-parser didn't.

Cutting a long story short, after trying a lot of things, I realised that I
had, as always, missed something simple.

I installed as root, and for some reason the install had set the properties of
the .rb files in html-parser to rwx for root, and nothing for anyone else.
Just adding the read properties fixed things.

--
Clear skies!
Mike Calder.


Ara.T.Howard

непрочетено,
5.05.2004 г., 19:18:175.05.04 г.
до
On Thu, 29 Apr 2004, Mike Calder wrote:

> Hi.
>
> I'm new to Ruby, and struggling; Ruby does not seem to be very easy to
> install under Linux.

it should be - should be an easy fix.

> I can't use the Suse RPM package, as I want the functionality of FOX and
> fxruby, and they aren't on the distro. So I installed Ruby, FOX, and fxruby
> from the source tars. After several problems with the install process
> (libraries didn't seem to go where Ruby assumes them to be), by adding links
> and setting environment variables I have managed to get these working; I can
> run trivial programs, and I get the GUI results expected.

you have two good choices

a) install ruby where your system looks for stuff

b) configure your system to look where ruby puts stuff

you should not need links or environment vars in either case. do a man
'ld.so' to grok what i'm talking about, but you might try this:

1) export LD_RUN_PATH=/usr/local/lib/

2) install fox, fxruby, and ruby in this location, for example:

./configure --prefix=/usr/local
make
sudo make install

(note that /usr/local is __probably__ the default for each of these)

this is assuming each of those packages installs with the standard
configure/make/make install business...

this would setup all the bins/libs for these packages to KNOW themselves where
to look for things - as having LD_RUN_PATH set at __complie__ time encodes it
in the binaries. this obviates the need to use envs or links.

> The problems just start afresh when I try to add extension libraries, or
> even run programs that need libraries that I think I have already installed.
>
> For example, there are a couple of sample programs that require soap and
> html parser functionality - I thought soap was part of the core, but I
> installed it again in any case, and also installed the html parser stuff.
> The installs run clean but the programs still give load errors.

run this

~ > which ruby
~ > which -a ruby

you probably have the following situation

* /usr/bin/ruby (1.6.8)
* /usr/local/bin/rbuy (1.8.1)

each of them looks for libs in a different place (based on version), you have
probably installed things with one ruby, but are running with another.

export PATH=/usr/local/bin:$PATH

and try again

in general, if you are having load errors do this

ruby -e 'p $LOAD_PATH'

this tells you where ruby looks for things - then check if they are there. if
they aren't then they have not been installed correctly or you are using a
different ruby which looks different places

> I suspect the problem is where the library modules and files are expected to
> be - I just can't sort it out; I've copied everything several times over in
> every place I think they should be; I have multiple copies all the same in
> ../ruby/1.8, ../ruby/site-ruby/1.8, in my home directory ../ruby/1.8
> and ../ruby/site-ruby/1.8.

but if you are running /usr/bin/ruby and it's 1.6.8 it won't look any of those
places...

> I've looked through various websites and documentation, and though there
> seems a lot of it, it's not very well organised and after three days
> struggling I can't find what I'm looking for; my questions are:
>
> Where does ruby expect library and extension files to be? What are the
> rules? Is there a single document that tells me how to sort this mess out?
>
> Can anyone point me? Ruby seems to be so close to what I want but if it's
> going to be like this all the time

stick with it. this really doen't have anything to do with ruby and every
thing to do with unix - understand the concepts of PATH, LD_RUN_PATH, and
LD_LIBRARY_PATH and you will be set for more that just ruby. if you have more
problems post some more.

welcome to the club.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================

Claus Spitzer

непрочетено,
5.05.2004 г., 20:42:135.05.04 г.
до
8< snip

> > I can't use the Suse RPM package, as I want the functionality of FOX and
> > fxruby, and they aren't on the distro. So I installed Ruby, FOX, and fxruby
> > from the source tars. After several problems with the install process
> > (libraries didn't seem to go where Ruby assumes them to be), by adding links
> > and setting environment variables I have managed to get these working; I can
> > run trivial programs, and I get the GUI results expected.
>

8< really big snip

This may end up going off a tangent, but perhaps one solution could be
to install apt-get (afaik there is a RedHat installer for it, should
work for Suse as well), and then get all the packages via that tool...


0 нови съобщения