Ruby on AIX?

A

Andreas Semt

Hello list!

Anybody who uses Ruby on an AIX machine (version 5.2 or higher)?
Just in case I have to work with such a system in the near future ...

Thanks for some info!
Best regards,
Andreas Semt
 
A

Austin Moody

I've been using Ruby on AIX (both 4.3 and 5.2) and it hasn't been easy.

Actually the latest release of 1.8.2 compiled for me perfectly, except
for the Socket library. This is a problem I'm yet to figured out.
--austin
 
A

Andreas Semt

Austin said:
I've been using Ruby on AIX (both 4.3 and 5.2) and it hasn't been easy.

Actually the latest release of 1.8.2 compiled for me perfectly, except
for the Socket library. This is a problem I'm yet to figured out.
--austin
Hello Austin!

Thanks for the answer.
So i can use the README instructions to compile and install Ruby? Or
does i have to use some "tricks" to get it done? If you figured the
Socket library problem out, let me (and the list) know!

Greetings,
Andreas
 
V

Victor Reyes

I also use Ruby in AIX, but I have problems every now and then.
I have 66 RS/6000 (AIX) servers and I have problems with many of then
installing Ruby. Furthermore, on the system running AIX 5.2, I can't
get socket support.
So, since I work on a distributed environment where we distribute the
same scripts to every server, and since Ruby refuse to work on every
server, I had to remove it from all. Too bad since I really like Ruby.
So, I went back to Korn Shell and Perl.
Oh well, the story of my life.

Victor
 
A

Andreas Semt

Victor said:
I also use Ruby in AIX, but I have problems every now and then.
I have 66 RS/6000 (AIX) servers and I have problems with many of then
installing Ruby. Furthermore, on the system running AIX 5.2, I can't
get socket support.
So, since I work on a distributed environment where we distribute the
same scripts to every server, and since Ruby refuse to work on every
server, I had to remove it from all. Too bad since I really like Ruby.
So, I went back to Korn Shell and Perl.
Oh well, the story of my life.

Victor

A sad story. Really. Sorry for you.

Greetings,
Andreas
 
A

Andreas Semt

Is someone currently working on a "port" for Ruby on AIX?
This would be *really* great ... a working socket library on AIX in the
future.

Greetings,
Andreas
 
M

Matt Lawrence

I've been using Ruby on AIX (both 4.3 and 5.2) and it hasn't been easy.

Actually the latest release of 1.8.2 compiled for me perfectly, except
for the Socket library. This is a problem I'm yet to figured out.

Please let me know what you find out, I'm trying to build ruby on AIX 5.1.
If I can get it to work, I should be able to get it added to the standard
image here at work. Since this would make Ruby readily available to
several thousand folks, it would be a very good thing. I already have
some engineers here who want to use it.

-- Matt
Nothing great was ever accomplished without _passion_
 
K

KUBO Takehiro

At Sun, 9 Jan 2005 01:38:23 +0900,
Andreas said:
Is someone currently working on a "port" for Ruby on AIX?
This would be *really* great ... a working socket library on AIX in the
future.

I have successfully compiled socket.so on AIX 4.3.3 and ruby 1.8.2.
(1) run configure script with '--disable-ipv6'.
(2) add '-eInit_socket' to DLDFLAGS in 'ext/socket/Makefile'.

./configure --disable-ipv6
vi ext/socket/Makefile
make

A very very simple one liner runs successfully:
ruby -rsocket -e "p Socket"

But, sorry, I have not test whether it actually works or not.
I don't know how to use it.
 
M

Matt Lawrence

I have successfully compiled socket.so on AIX 4.3.3 and ruby 1.8.2.
(1) run configure script with '--disable-ipv6'.
(2) add '-eInit_socket' to DLDFLAGS in 'ext/socket/Makefile'.

Ok, that seems to work on AIX 5.1. However, it gets a Segmentation fault
in socket.so when I go to run it. Help?

I really want to get this working, and while I can't offer a great reward,
I'll take whoever solves this out for a nice dinner at the next Ruby
Conference.

-- Matt
Nothing great was ever accomplished without _passion_
 
N

nobu.nokada

Hi,

At Sat, 15 Jan 2005 07:18:25 +0900,
Matt Lawrence wrote in [ruby-talk:126507]:
Does it direct the entry point or to export the symbol?
Anyway, -eInit_foo option is required on AIX in general?
Ok, that seems to work on AIX 5.1. However, it gets a Segmentation fault
in socket.so when I go to run it. Help?

Can you show the stack trace?
 
K

KUBO Takehiro

Hi,

At Sat, 15 Jan 2005 10:01:09 +0900,
Does it direct the entry point or to export the symbol?

It directs the entry point.
Anyway, -eInit_foo option is required on AIX in general?

I can't say about other AIX platforms.
As far as in my environment each extionsion library requires -eInit_foo.

The following sample works correctly on AIX 5.2 by adding -eInit_socket.

require 'net/http'
Net::HTTP.start('www.example.com', 80) { |http|
response = http.get('/index.html')
puts response.body
}
 
N

nobu.nokada

Hi,

At Mon, 17 Jan 2005 17:58:53 +0900,
KUBO Takehiro wrote in [ruby-talk:126800]:
I can't say about other AIX platforms.
As far as in my environment each extionsion library requires -eInit_foo.

Sorry, it seems my typo.


Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.263
diff -U2 -p -r1.263 configure.in
--- configure.in 30 Dec 2004 15:09:42 -0000 1.263
+++ configure.in 17 Jan 2005 14:24:32 -0000
@@ -882,5 +882,5 @@ if test "$with_dln_a_out" != yes; then
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
- ARCH_FLAGS='-eInit_$(TARGET)'
+ ARCH_FLAG='-eInit_$(TARGET)'
: LDFLAGS="-brtl $LDFLAGS"
: ${ARCHFILE="ruby.imp"}
 
M

Matt Lawrence

Can you show the stack trace?

Sure. This is with a script that only has 'require "net/telnet"'
dbx ./testit
Type 'help' for help.
Core file program (ruby) does not match current program (core ignored)
reading symbolic information ...
(dbx) run

Segmentation fault in bignum. at 0x200e2ccc
0x200e2ccc (???) d11c6d20 stfs fr8,0x6d20(r28)
(dbx) where
bignum.(??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??, ??,
??, ??, ??, ??, ) at 0x200e2ccc
unnamed block $b49, line 1398 in "dln.c"
dln_load(0x200b1318), line 1398 in "dln.c"
unnamed block $b254, line 6858 in "eval.c"
unnamed block $b253, line 6858 in "eval.c"
rb_require_safe(0x20063a10, 0x0), line 6858 in "eval.c"
rb_f_require(0x20072e20, 0x20053598), line 6731 in "eval.c"
call_cfunc(0x20031080, 0x20072e20, 0x1, 0x1, 0x2ff201a0), line 5393 in
"eval.c"
unnamed block $b83, line 5522 in "eval.c"
unnamed block $b82, line 5522 in "eval.c"
unnamed block $b81, line 5522 in "eval.c"
rb_call0(0x200740f4, 0x20072e20, 0x2451, 0x2451, 0x1, 0x2ff201a0,
0x20065310, 0x0), line 5522 in "eval.c"
rb_call(0x200740f4, 0x20072e20, 0x2451, 0x1, 0x2ff201a0, 0x1), line 5743
in "eval.c"
unnamed block $b187, line 3244 in "eval.c"
unnamed block $b186, line 3244 in "eval.c"
rb_eval(0x20072e20, 0x20063948), line 3244 in "eval.c"
eval_node(0x20072e20, 0x20063948), line 1296 in "eval.c"
unnamed block $b261, line 6528 in "eval.c"
unnamed block $b260, line 6528 in "eval.c"
unnamed block $b259, line 6528 in "eval.c"
unnamed block $b258, line 6528 in "eval.c"
unnamed block $b257, line 6528 in "eval.c"
unnamed block $b256, line 6528 in "eval.c"
rb_load(0x20063b50, 0x0), line 6528 in "eval.c"
unnamed block $b254, line 6849 in "eval.c"
unnamed block $b253, line 6849 in "eval.c"
rb_require_safe(0x20063c90, 0x0), line 6849 in "eval.c"
rb_f_require(0x20072e20, 0x20063c2c), line 6731 in "eval.c"
call_cfunc(0x20031080, 0x20072e20, 0x1, 0x1, 0x2ff21650), line 5393 in
"eval.c"
unnamed block $b83, line 5522 in "eval.c"
unnamed block $b82, line 5522 in "eval.c"
unnamed block $b81, line 5522 in "eval.c"
rb_call0(0x200740f4, 0x20072e20, 0x2451, 0x2451, 0x1, 0x2ff21650,
0x20065310, 0x0), line 5522 in "eval.c"
rb_call(0x200740f4, 0x20072e20, 0x2451, 0x1, 0x2ff21650, 0x1), line 5743
in "eval.c"
unnamed block $b187, line 3244 in "eval.c"
unnamed block $b186, line 3244 in "eval.c"
rb_eval(0x20072e20, 0x20063c54), line 3244 in "eval.c"
eval_node(0x20072e20, 0x20063c54), line 1296 in "eval.c"
unnamed block $b115, line 1473 in "eval.c"
unnamed block $b114, line 1473 in "eval.c"
ruby_exec_internal(), line 1473 in "eval.c"
ruby_exec(), line 1493 in "eval.c"
ruby_run(), line 1503 in "eval.c"
main(argc = 2, argv = 0x2ff224b4, envp = 0x2ff224c0), line 46 in "main.c"
(dbx)

Any other info I can get for you?

-- Matt
Nothing great was ever accomplished without _passion_
 
K

KUBO Takehiro

Hi,

Sorry, it seems my typo.

Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.263
diff -U2 -p -r1.263 configure.in
--- configure.in 30 Dec 2004 15:09:42 -0000 1.263
+++ configure.in 17 Jan 2005 14:24:32 -0000
@@ -882,5 +882,5 @@ if test "$with_dln_a_out" != yes; then
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
- ARCH_FLAGS='-eInit_$(TARGET)'
+ ARCH_FLAG='-eInit_$(TARGET)'
: LDFLAGS="-brtl $LDFLAGS"
: ${ARCHFILE="ruby.imp"}

This cause an error while linking miniruby by passing '-eInit_' to the linker.

The following obviously unacceptable patch solved the problem.
It will be available only on AIX....

--- ruby-1.8.2/lib/mkmf.rb~ 2004-09-18 15:56:36.000000000 +0900
+++ ruby-1.8.2/lib/mkmf.rb 2005-01-19 21:22:27.000000000 +0900
@@ -1035,7 +1035,7 @@
if CONFIG["DLEXT"] == $OBJEXT
"ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)\n"
else
- "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB) " \
+ "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB) -eInit_$(TARGET) " \
"$(OBJS) $(LOCAL_LIBS) $(LIBS)"
end
LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'

1. apply this patch.
2. 'make distclean'
3. configure and make again.
 
N

nobu.nokada

Hi,

At Wed, 19 Jan 2005 21:52:06 +0900,
KUBO Takehiro wrote in [ruby-talk:127124]:
This cause an error while linking miniruby by passing '-eInit_' to the linker.

What about adding the option to DLDFLAGS instead of ARCH_FLAG?
 
M

Matt Lawrence

Ok, the patch didn't seem to work, so I added in a fix that should do the
same. I'm not sure if I'm using a version anywhere close to what is being
worked on, I'm using the 1.8.2 tarball. For some reason, "make" winds up
running configure again so that it ends with:

configure: creating ./config.status
MAKE=make /bin/sh ./config.status
config.status: creating Makefile
Makefile updated, restart.
make: The error code from the last command is 1.

After running "make" again, it fails with:

cc -g -eInit_ main.o dmyext.o libruby-static.a -ldl -lcrypt
-lm -o miniruby
ld: 0711-327 WARNING: Entry point not found: Init_
Could not load program ./miniruby:
The program does not have an entry point or
the o_snentry field in the auxiliary header is invalid.
Examine file headers with the 'dump -ohv' command.
make: The error code from the last command is 255.


Stop.


The script I use to run this is:

#!/usr/bin/ksh -x

VER="ruby-1.8.2"

rm -rf $VER
rm -rf $HOME/bin/*

tar -xf $VER.tar
cd $VER

cp configure.in configure.in.tmp
sed 's/ARCH_FLAGS/ARCH_FLAG/' <configure.in.tmp >configure.in

/configure --without-gcc --disable-ipv6 --prefix=$HOME

make
make || exit
make test || exit
make install || exit



What should I try next?

-- Matt
Nothing great was ever accomplished without _passion_
 
K

KUBO Takehiro

At Sat, 22 Jan 2005 01:37:24 +0900,
Hi,

At Wed, 19 Jan 2005 21:52:06 +0900,
KUBO Takehiro wrote in [ruby-talk:127124]:
This cause an error while linking miniruby by passing '-eInit_' to the linker.

What about adding the option to DLDFLAGS instead of ARCH_FLAG?

Another error at ext/curses.

compiling curses
cc -g -I. -I../.. -I../../. -I../.././ext/curses -DHAVE_CURSES_H -DHAVE_BEEP -DHAVE_BKGD -DHAVE_BKGDSET -DHAVE_CURS_SET -DHAVE_DELETELN -DHAVE_DOUPDATE -DHAVE_FLASH -DHAVE_GETBKGD -DHAVE_GETNSTR -DHAVE_INIT -DHAVE_ISENDWIN -DHAVE_KEYNAME -DHAVE_KEYPAD -DHAVE_RESIZETERM -DHAVE_SCRL -DHAVE_SET -DHAVE_SETSCRREG -DHAVE_UNGETCH -DHAVE_WATTROFF -DHAVE_WATTRON -DHAVE_WATTRSET -DHAVE_WBKGD -DHAVE_WBKGDSET -DHAVE_WDELETELN -DHAVE_WGETNSTR -DHAVE_WRESIZE -DHAVE_WSCRL -DHAVE_WSETSCRREG -DHAVE_DEF_PROG_MODE -DHAVE_RESET_PROG_MODE -DHAVE_TIMEOUT -DHAVE_WTIMEOUT -DHAVE_NODELAY -DHAVE_INIT_COLOR -c curses.c
/usr/ccs/bin/ld -brtl -bI:../../ruby.imp -bM:SRE -T512 -H512 -eInit_curses -L"../.." -o curses.so curses.o -lcurses -ltermcap -ldl -lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .wresize
ld: 0711-317 ERROR: Undefined symbol: .resizeterm
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: The error code from the last command is 8.

have_func() in extconf.rb doesn't work correctly.
Even though testing symbol doesn't exit, cc's exit code is zero.

$ cat conftest.c
int main() { return 0; }
int t() { wresize(); return 0; }

$ cc -brtl -bI:/home/kubo/src/ruby-1.8.2/ruby.imp -bM:SRE -T512 -H512 -eInit_$(TARGET) -oconftest -I/home/kubo/src/ruby-1.8.2 -I../../. -g conftest.c -L"/home/kubo/src/ruby-1.8.2" -lcurses -ltermcap -lruby-static -lcurses -ltermcap -ldl -lcrypt -lm -lc
bash: TARGET: command not found
ld: 0711-327 WARNING: Entry point not found: Init_
$ echo $?
0

If '-eInit_$(TARGET)' is not set, its exit code is non-zero as expected.

$ cc -brtl -bI:/home/kubo/src/ruby-1.8.2/ruby.imp -bM:SRE -T512 -H512 -oconftest -I/home/kubo/src/ruby-1.8.2 -I../../. -g conftest.c -L"/home/kubo/src/ruby-1.8.2" -lcurses -ltermcap -lruby-static -lcurses -ltermcap -ldl -lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .wresize
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
$ echo $?
8
 
N

nobu.nokada

Hi,

At Sat, 29 Jan 2005 14:53:31 +0900,
KUBO Takehiro wrote in [ruby-talk:128791]:
have_func() in extconf.rb doesn't work correctly.

I see. What about this patch?


Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.212.2.24
diff -U2 -p -r1.212.2.24 configure.in
--- configure.in 17 Jan 2005 14:34:09 -0000 1.212.2.24
+++ configure.in 30 Jan 2005 04:00:05 -0000
@@ -895,9 +895,8 @@ if test "$with_dln_a_out" != yes; then
aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
- DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
- ARCH_FLAG='-eInit_$(TARGET)'
- : LDFLAGS="-brtl $LDFLAGS"
+ DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
+ LDFLAGS="-brtl $LDFLAGS"
: ${ARCHFILE="ruby.imp"}
- TRY_LINK='$(CC) $(DLDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
+ TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
rb_cv_dlopen=yes ;;
 
K

KUBO Takehiro

Hi,

At Sun, 30 Jan 2005 13:05:04 +0900,
Hi,

At Sat, 29 Jan 2005 14:53:31 +0900,
KUBO Takehiro wrote in [ruby-talk:128791]:
have_func() in extconf.rb doesn't work correctly.

I see. What about this patch?

OK. It works fine on AIX 4.3.3.

testing script is:

require 'net/http'
Net::HTTP.start('www.example.com', 80) { |http|
response = http.get('/index.html')
puts response.body
}

What about Matt's environment?
 
M

Matt Lawrence

testing script is:

require 'net/http'
Net::HTTP.start('www.example.com', 80) { |http|
response = http.get('/index.html')
puts response.body
}

What about Matt's environment?

Now that I finally have time to work on building Ruby again, it seems to
work. Thanks for al the wonderful help! You folks are great.

Here's the very primitive script that I am using to build Ruby on AIX for
testing (my next goal is to get it added to the standard image):

#!/usr/bin/ksh -x

VER="ruby-1.8.2"

rm -rf $VER
rm -rf $HOME/ruby/*

tar -xf $VER.tar
cd $VER

cd lib
cp mkmf.rb mkmf.rb.tmp
sed 's/OUTFLAG}\$(DLLIB)/OUTFLAG}$(DLLIB) -eInit_\$(TARGET)/' <mkmf.rb.tmp
cd ..

/configure --without-gcc --disable-ipv6 --prefix=$HOME/ruby

make || exit
make test || exit
make install || exit


-- Matt
Nothing great was ever accomplished without _passion_
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top