Compiling on AIX

W

Will

I'm just about at my wit's end here... I am trying to compile Ruby
1.8.3 on AIX 5.1. I have tried gcc and I've tried xlc, neither works,
although they die at different points. I get further if I use the
--with-static-linked-ext configure option, but it still dies. The two
errors I am seeing most often (on many different attempts) are:

1. ruby.imp is missing (is this a file that is supposed to be created
during the build?).
2. "gcc error: -b must come at the beginning of a line". Moving all
instances of -brtl to the beginning of the flags variables does not fix
this, nor does removing it altogether.

I've read about other people having trouble getting this to compile,
but what I don't see is a solution anywhere. Has anyone done this? If
so, any pointers to get me moving again would be much appreciated!
I've been banging my head against a wall on this for quite some time.

Thanks,
Will
 
W

Will

So I had ok luck compiling on an AIX 5.3 box, but unfortunately I have
no ability to upgrade the machine I need ruby on to 5.3, at least not
in the short-term. Is there really nobody else who's run into the
problem?

Thanks,
Will
 
W

Will

Ok, I've managed to get things to compile up to the socket library,
where I hit this error:
gmake[1]: Entering directory `/tmp/wrbriggs/ruby-1.8.3/ext/socket'
cc -g -I. -I../.. -I../../. -I../.././ext/socket -DHAVE_SIN_LEN
-DHAVE_SOCKADDR_STORAGE -DHAVE_SA_LEN -DHAVE_NETINET_TCP_H
-DHAVE_NETINET_UDP_H -DHAVE_SENDMSG -DHAVE_RECVMSG
-DHAVE_ST_MSG_CONTROL -DHAVE_GETNAMEINFO -DHAVE_GETADDRINFO
-DHAVE_TYPE_SOCKLEN_T -DHAVE_SYS_UN_H -DHAVE_SYS_UIO_H -DHAVE_SOCKET
-DHAVE_GETIPNODEBYNAME -DHAVE_SOCKETPAIR -DHAVE_GETHOSTNAME
-Dss_family=__ss_family -Dss_len=__ss_len -c socket.c
"../../ruby.h", line 68.1: 1506-224 (I) Incorrect #pragma ignored.
"socket.c", line 983.81: 1506-280 (W) Function argument assignment
between types "unsigned long*" and "int*" is not allowed.
"socket.c", line 1013.85: 1506-280 (W) Function argument assignment
between types "unsigned long*" and "int*" is not allowed.
"socket.c", line 1415.29: 1506-280 (W) Function argument assignment
between types "unsigned long(*)(unsigned long)" and "unsigned
long(*)()" is not allowed.
/usr/ccs/bin/ld -brtl -eInit_socket -bI:../../ruby.imp -bM:SRE -T512
-H512 -L"../.." -o ../../.ext/powerpc-aix5.1.0.0/socket.so socket.o
-ldl -lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .CMSG_SPACE
ld: 0711-317 ERROR: Undefined symbol: .CMSG_LEN
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.

I really, really want to start using Ruby for some work-related
projects, but without AIX support, I can't. Anyone help AT ALL would
be really, really appreciated!

Thanks yet again,
Will
 
N

nobu.nokada

Hi,

At Thu, 20 Oct 2005 04:06:59 +0900,
Will wrote in [ruby-talk:161458]:
1. ruby.imp is missing (is this a file that is supposed to be created
during the build?).

Yes. Generated Makefile doesn't contain "ARCHFILE = ruby.imp"
line?
2. "gcc error: -b must come at the beginning of a line". Moving all
instances of -brtl to the beginning of the flags variables does not fix
this, nor does removing it altogether.

What are CFLAGS, LDFLAGS and DLDFLAGS in Makefile?

At Fri, 21 Oct 2005 06:36:59 +0900,
Will wrote in [ruby-talk:161751]:
Ok, I've managed to get things to compile up to the socket library,

How did you solve aboves?
"../../ruby.h", line 68.1: 1506-224 (I) Incorrect #pragma ignored.

Probably, alloca pragma is only for gcc?
/usr/ccs/bin/ld -brtl -eInit_socket -bI:../../ruby.imp -bM:SRE -T512
-H512 -L"../.." -o ../../.ext/powerpc-aix5.1.0.0/socket.so socket.o
-ldl -lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .CMSG_SPACE
ld: 0711-317 ERROR: Undefined symbol: .CMSG_LEN
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.

What are those symbols? Can't you show the "more information"?
 
W

Will

Hi Nobu, I think I've managed to solve several of the issues (I have
what I hope is a fully functioning Ruby install under AIX 5.1). Here
is what I had to do to get it to work:
export CC=cc
export CPPFLAGS=-I/usr/local/include (for self-compiled zlib.h header -
it was not being detected without this, and zlib compilation was being
skipped with no errors).

../configure --without-gcc --disable-ipv6

When configure completed:
make ruby.imp
make
Failed at socket with error above - I had to edit the ext/socket
Makefile to include -D_LINUX_SOURCE_COMPAT in the CPPFLAGS line. The
AIX 5.1 sys/socket.h will not export the CMSG_SPACE and CMSG_LEN (and
some other) symbols unless _LINUX_SOURCE_COMPAT is defined.

After that, the build went pretty smoothly. I was able to install
rubygems, and install several gems as well. The only error I am seeing
now is when I run a make install-doc:
........................................
Generating RI...
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/markup/simple_markup.rb:331:in `=~':
Stack overflow in regexp matcher: /^( (RegexpError)
( \[.*?\] (?# labeled )
|\S.*:: (?# note )
)(?=\s|$)
\s*
)/x from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/markup/simple_markup.rb:331:i
n `assign_types_to_lines'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/markup/simple_markup.rb:255:in
`convert'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:224:in
`markup'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:153:in
`generate_method_in
fo'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:133:in
`generate_class_inf
o'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:132:in
`generate_class_inf
o'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:90:in
`process_class'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:85:in
`generate'
from
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/generators/ri_generator.rb:84:in
`generate'
from /tmp/wrbriggs/ruby-1.8.3/lib/rdoc/rdoc.rb:263:in
`document'
from ./bin/rdoc:63
make: *** [do-install-doc] Error 1

This makes me a little concerned that the build is not as error-free as
I had hoped, but I will keep you posted. Any suggestions you have on a
cleaner way to do this build would be much appreciated.

Thank you for your response!

-Will
 
N

nobuyoshi nakada

Hi,

At Fri, 21 Oct 2005 09:57:00 +0900,
Will wrote in [ruby-talk:161771]:
export CPPFLAGS=-I/usr/local/include (for self-compiled zlib.h header -
it was not being detected without this, and zlib compilation was being
skipped with no errors).

Although you can also use
--with-opt-include=/usr/local/include or
--with-zlib-include=/usr/local/include.

But that directory should be searched in default unless you
change the prefix. Can't you show mkmf.log file under
ext/zlib?
../configure --without-gcc --disable-ipv6

When configure completed:
make ruby.imp
make

I see. ruby.imp is created automatically when enable-shared.
I didn't know that it is needed always. And I found
[ruby-talk:144239] and [ruby-talk:144427], but it has been
left because no reply after then.
Failed at socket with error above - I had to edit the ext/socket
Makefile to include -D_LINUX_SOURCE_COMPAT in the CPPFLAGS line. The
AIX 5.1 sys/socket.h will not export the CMSG_SPACE and CMSG_LEN (and
some other) symbols unless _LINUX_SOURCE_COMPAT is defined.

Is it commont to AIX?
After that, the build went pretty smoothly. I was able to install
rubygems, and install several gems as well. The only error I am seeing
now is when I run a make install-doc:
........................................
Generating RI...
/tmp/wrbriggs/ruby-1.8.3/lib/rdoc/markup/simple_markup.rb:331:in `=~':
Stack overflow in regexp matcher: /^( (RegexpError)
( \[.*?\] (?# labeled )
|\S.*:: (?# note )
)(?=\s|$)
\s*
)/x from

Unnecessary backtrack could be removed. BTW, what line it
failed against?

$ ruby18 -e 'p /^((\[.*?\]|\S.*::)(?=\s|$)\s*)/=~"::"*(1<<10)'
0
$ ruby18 -e 'p /^((\[.*?\]|\S.*::)(?=\s|$)\s*)/=~"::"*(1<<11)'
-e:1: Stack overflow in regexp matcher: /^((\[.*?\]|\S.*::)(?=\s|$)\s*)/ (RegexpError)

And, parse.c in 1.8.3 has a bug potentially, you'll want to
re-create it with bison 1.x if you have.


Index: common.mk
===================================================================
RCS file: /cvs/ruby/src/ruby/common.mk,v
retrieving revision 1.13.2.4
diff -U2 -p -r1.13.2.4 common.mk
--- common.mk 3 Aug 2005 15:27:06 -0000 1.13.2.4
+++ common.mk 21 Oct 2005 03:30:52 -0000
@@ -57,5 +57,5 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)"
EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC) --

-all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
+all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY) $(ARCHFILE)
@$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
prog: $(PROGRAM) $(WPROGRAM)
Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.212.2.35
diff -U2 -p -r1.212.2.35 configure.in
--- configure.in 6 Sep 2005 23:22:56 -0000 1.212.2.35
+++ configure.in 21 Oct 2005 03:30:52 -0000
@@ -231,4 +231,22 @@ AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(time_t, 0)

+AC_DEFUN(RUBY_TRY_CFLAGS,
+[{
+cflags_ok=
+if test "${CFLAGS+set}"; then
+ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS [$1]"
+else
+ unset save_CFLAGS; CFLAGS="[$1]"
+fi
+AC_TRY_COMPILE([], [], [cflags_ok=yes], [cflags_ok=no])
+if test "${save_CFLAGS+set}"; then
+ CFLAGS="$save_CFLAGS"
+ unset save_CFLAGS
+else
+ unset CFLAGS
+fi
+test $cflags_ok = yes
+}])
+
for id in pid_t gid_t uid_t; do
AC_CHECK_TYPE($id, [typ=$id], [typ=int])
@@ -923,6 +941,11 @@ if test "$with_dln_a_out" != yes; then
aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
- DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
- LDFLAGS="-brtl $LDFLAGS"
+ DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
+ flag=-brtl
+ test "$GCC" = yes && flag=-Wl,$flag
+ if RUBY_TRY_CFLAGS(-brtl); then
+ DLDFLAGS="-brtl $DLDFLAGS"
+ LDFLAGS="-brtl $LDFLAGS"
+ fi
: ${ARCHFILE="ruby.imp"}
TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
Index: ext/socket/extconf.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/ext/socket/extconf.rb,v
retrieving revision 1.36.2.5
diff -U2 -p -r1.36.2.5 extconf.rb
--- ext/socket/extconf.rb 19 Jul 2005 19:04:46 -0000 1.36.2.5
+++ ext/socket/extconf.rb 21 Oct 2005 02:30:41 -0000
@@ -26,7 +26,10 @@ unless $mswin or $bccwin or $mingw
headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h>
end
-if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
+case RUBY_PLATFORM
+when /^solaris/
# bug of gcc 3.0 on Solaris 8 ?
- headers << "sys/feature_tests.h"
+ headers << "sys/feature_tests.h" unless try_compile("")
+when /^aix/
+ $defs << "-D_LINUX_SOURCE_COMPAT"
end

Index: lib/rdoc/markup/simple_markup.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rdoc/markup/simple_markup.rb,v
retrieving revision 1.1.2.1
diff -U2 -p -r1.1.2.1 simple_markup.rb
--- lib/rdoc/markup/simple_markup.rb 24 Apr 2004 01:39:45 -0000 1.1.2.1
+++ lib/rdoc/markup/simple_markup.rb 21 Oct 2005 03:25:11 -0000
@@ -195,6 +195,5 @@ module SM #:nodoc:
( \[.*?\] (?# labeled )
|\S.*:: (?# note )
- )(?=\s|$)
- \s*
+ )(?:\s+|$)
)/x
 

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

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,742
Latest member
AshliMayer

Latest Threads

Top