Building Ruby on AIX -- again

I finally have a stable system to use to try to build Ruby. Here's the
info:

oslevel

5.2.0.0

gcc --version

gcc (GCC) 3.3.3
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

And here's the error I'm getting:

/usr/src/ruby-1.8.1>make
        gcc -g -O2 -I. -I. -c array.c
In file included from ruby.h:671,
                 from array.c:15:
missing.h:81: error: conflicting types for `memmove'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.3/include/string.h:118:
error: previous declaration of `memmove'
missing.h:95: error: conflicting types for `strcasecmp'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.3/include/string.h:237:
error: previous declaration of `strcasecmp'
missing.h:99: error: conflicting types for `strncasecmp'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.3/include/string.h:238:
error: previous declaration of `strncasecmp'
missing.h:112: warning: `struct tm' declared inside parameter list
missing.h:112: warning: its scope is only this definition or declaration,
which is probably not what you want
missing.h:116: warning: conflicting types for built-in function `strstr'
missing.h:126: error: conflicting types for `strtoul'
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.3/include/stdlib.h:183:
error: previous declaration of `strtoul'
make: 1254-004 The error code from the last command is 1.

Any ideas?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

Hi,

At Fri, 25 Jun 2004 09:47:04 +0900,
Matt Lawrence wrote in [ruby-talk:104501]:

I finally have a stable system to use to try to build Ruby. Here's the
info:

>oslevel
5.2.0.0

>gcc --version
gcc (GCC) 3.3.3
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

What version of ruby?

And here's the error I'm getting:

Seems configure script failed to detect functions. Can you
show us the config.log?

···

--
Nobu Nakada

What version of ruby?

1.8.1

> And here's the error I'm getting:

Seems configure script failed to detect functions. Can you
show us the config.log?

It's really long. After going through the log, it looks like configure is
trying to link against libm, which doesn't exist. My guess is that
configure needs to be told what the correct library is.

I'm way outside my expertise right now, I have no clue how the configure
process actually works.

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Fri, 25 Jun 2004 nobu.nokada@softhome.net wrote:

Hi,

At Fri, 25 Jun 2004 12:15:08 +0900,
Matt Lawrence wrote in [ruby-talk:104511]:

> What version of ruby?

1.8.1

2003-12-25, official release?

It's really long. After going through the log, it looks like configure is
trying to link against libm, which doesn't exist. My guess is that
configure needs to be told what the correct library is.

libm really doesn't exist? Then where are math functions?

···

--
Nobu Nakada

Ok, I'm an idiot. I needed to install the bos.adt.* packages. Hopefully
somebody else will find this message in the archives and avoid looking
like a fool.

Now I'm down to this error:

compiling iconv
        gcc -g -O2 -I. -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1
-I/usr/src/ruby-1.8.1/ext/iconv -DHAVE_ICONV_H -DICONV_INPTR_CAST="(char
**)" -I/usr/include -c iconv.c
        /usr/ccs/bin/ld -brtl -eInit_iconv
-bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -o iconv.so iconv.o -ldl
-lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .iconv_open
ld: 0711-317 ERROR: Undefined symbol: .iconv_close
ld: 0711-317 ERROR: Undefined symbol: .iconv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
make: 1254-004 The error code from the last command is 8.

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Fri, 25 Jun 2004 nobu.nokada@softhome.net wrote:

> It's really long. After going through the log, it looks like configure is
> trying to link against libm, which doesn't exist. My guess is that
> configure needs to be told what the correct library is.

libm really doesn't exist? Then where are math functions?

Hi,

At Fri, 25 Jun 2004 13:06:57 +0900,
Matt Lawrence wrote in [ruby-talk:104513]:

compiling iconv
        gcc -g -O2 -I. -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1
-I/usr/src/ruby-1.8.1/ext/iconv -DHAVE_ICONV_H -DICONV_INPTR_CAST="(char
**)" -I/usr/include -c iconv.c
        /usr/ccs/bin/ld -brtl -eInit_iconv
-bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -o iconv.so iconv.o -ldl
-lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .iconv_open
ld: 0711-317 ERROR: Undefined symbol: .iconv_close
ld: 0711-317 ERROR: Undefined symbol: .iconv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
make: 1254-004 The error code from the last command is 8.

Seems like iconv library doesn't get installed. Show the
mkmf.log.

···

--
Nobu Nakada

And the fix is shown in
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88697

Add -liconv to DLDFLAGS in ext/iconv/Makefile.

Any ideas on how to get configure to do the right thing for this one?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Fri, 25 Jun 2004, Matt Lawrence wrote:

Now I'm down to this error:

compiling iconv
        gcc -g -O2 -I. -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1
-I/usr/src/ruby-1.8.1/ext/iconv -DHAVE_ICONV_H -DICONV_INPTR_CAST="(char
**)" -I/usr/include -c iconv.c
        /usr/ccs/bin/ld -brtl -eInit_iconv
-bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -o iconv.so iconv.o -ldl
-lcrypt -lm -lc
ld: 0711-317 ERROR: Undefined symbol: .iconv_open
ld: 0711-317 ERROR: Undefined symbol: .iconv_close
ld: 0711-317 ERROR: Undefined symbol: .iconv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
make: 1254-004 The error code from the last command is 8.

I'm making progress. Now socket isn't being built. Here's an excerpt
from ext/socket/mkmf.log:

"gcc -o conftest -I/usr/local/lib/ruby/1.8/powerpc-aix5.2.0.0
-I/usr/local/lib/r
uby/1.8/powerpc-aix5.2.0.0 -I/usr/include -g -O2 conftest.c
-L"/usr/local/lib"
   -brtl -eInit_$(TARGET) -bI:/usr/src/ruby-1.8.1/ext/socket/ruby.imp
-bM:SRE -T
512 -H512 -lc -liconv -lruby-static -lnsl -ldl -lcrypt -lm -lc"
sh: TARGET: not found.
gcc: `-b' must come at the start of the command line

I'm not sure how these commands are being built, so I don't know how to
move the -b option. Help?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

Hi,

At Fri, 25 Jun 2004 13:29:58 +0900,
Matt Lawrence wrote in [ruby-talk:104516]:

Add -liconv to DLDFLAGS in ext/iconv/Makefile.

It's the wrong workaround.

Any ideas on how to get configure to do the right thing for this one?

Show the ext/iconv/mkmf.log. Otherwise I have no clue to solve
it.

···

--
Nobu Nakada

]/usr/src/ruby-1.8.1/ext/iconv>cat mkmf.log
have_header: checking for iconv.h... -------------------- yes

"gcc -E -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2 conftest.c -o
conftest.i"
checked program was:
/* begin */
#include <iconv.h>
/* end */

···

On Fri, 25 Jun 2004 nobu.nokada@softhome.net wrote:

Show the ext/iconv/mkmf.log. Otherwise I have no clue to solve

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

"gcc -c -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2 -Werror
conftest.c"
checked program was:
/* begin */
/* end */

checking for iconv() 2nd argument is const... -------------------- no

"gcc -c -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2 -Werror
conftest.c"
checked program was:
/* begin */

#include <iconv.h>
size_t
test(iconv_t cd, char **inptr, size_t *inlen, char **outptr, size_t
*outlen)
{
    return iconv(cd, inptr, inlen, outptr, outlen);
}
/* end */

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

have_library: checking for main() in -liconv... -------------------- no

"gcc -o conftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2
conftest.c -L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -brtl
-eInit_$(TARGET) -bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-lruby-static -liconv -ldl -lcrypt -lm -lc"
sh: TARGET: not found.
gcc: `-b' must come at the start of the command line
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { main(); return 0; }
/* end */

"gcc -o conftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2
conftest.c -L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -brtl
-eInit_$(TARGET) -bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-lruby-static -liconv -ldl -lcrypt -lm -lc"
sh: TARGET: not found.
gcc: `-b' must come at the start of the command line
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

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

Hi,

At Fri, 25 Jun 2004 16:12:39 +0900,
Matt Lawrence wrote in [ruby-talk:104521]:

"gcc -o conftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2
conftest.c -L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -brtl
-eInit_$(TARGET) -bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512 -lc
-lruby-static -liconv -ldl -lcrypt -lm -lc"
sh: TARGET: not found.
gcc: `-b' must come at the start of the command line

Ok, same as [ruby-talk:104519].

Does this patch help?

Index: configure.in

···

===================================================================
RCS file: /pub/cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.212.2.11
diff -u -2 -p -r1.212.2.11 configure.in
--- configure.in 12 Jun 2004 02:34:36 -0000 1.212.2.11
+++ configure.in 25 Jun 2004 08:08:01 -0000
@@ -908,7 +908,10 @@ if test "$with_dln_a_out" != yes; then
   aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
       XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
- DLDFLAGS="$DLDFLAGS "'-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
- : LDFLAGS="$LDFLAGS -brtl"
+ DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
+ ARCH_FLAGS='-eInit_$(TARGET)'
+ : LDFLAGS="-brtl $LDFLAGS"
       : ${ARCHFILE="ruby.imp"}
+ TRY_LINK='$(CC) $(DLDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
+ TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
       rb_cv_dlopen=yes ;;

--
Nobu Nakada

That patch worked perfectly. I've been trying to stay with the current
released version, 1.8.1. Should I be trying the nightly snapshot instead?

Now I'm back to the problem of the socket library not getting built. The
error seems to be:

have_library: checking for t_open() in -lnsl... -------------------- no

"gcc -o conftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2
conftest.c
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -brtl
-bI:/usr/src/ruby-1.8.1/ruby
.imp -bM:SRE -T512 -H512 -lruby-static -lnsl -ldl -lcrypt -lm -lc"
gcc: `-b' must come at the start of the command line
checked program was:

Ideas?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Fri, 25 Jun 2004 nobu.nokada@softhome.net wrote:

Does this patch help?

Hi,

At Sat, 26 Jun 2004 02:26:44 +0900,
Matt Lawrence wrote in [ruby-talk:104575]:

That patch worked perfectly. I've been trying to stay with the current
released version, 1.8.1. Should I be trying the nightly snapshot instead?

1.8.2 preview will be released soon, perhaps.

"gcc -o conftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2
conftest.c
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -brtl
-bI:/usr/src/ruby-1.8.1/ruby
.imp -bM:SRE -T512 -H512 -lruby-static -lnsl -ldl -lcrypt -lm -lc"

It seems that the patch hasn't been reflected. If it were
applied correctly, the command run by have_library shouldn't
have a space between -o and conftest.

···

--
Nobu Nakada

I double checked the patch. Then I deleted the entire source directory
and recreated it, copied in the patched configure.in, ran autoconf, ran
configure and then ran make. Same problem. Am I doing something wrong?

Here's an excerpt of the patched config.in:

        aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
                        XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
                        DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE
-T512 -H5
12 '"$DLDFLAGS"
                        ARCH_FLAGS='-eInit_$(TARGET)'
                        : LDFLAGS="-brtl $LDFLAGS"
                        : ${ARCHFILE="ruby.imp"}
                        TRY_LINK='$(CC) $(DLDFLAGS) -oconftest $(INCFLAGS)
-I$(h
drdir) $(CPPFLAGS) $(CFLAGS)'
                        TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH)
$(LOCAL_LIBS) $(
LIBS)'
                        rb_cv_dlopen=yes ;;

Slightly mangled by Pine wordwrapping. Oops. What do you think? Any
idea of what I should try next?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Sat, 26 Jun 2004 nobu.nokada@softhome.net wrote:

It seems that the patch hasn't been reflected. If it were
applied correctly, the command run by have_library shouldn't
have a space between -o and conftest.

Hi,

At Sat, 26 Jun 2004 11:07:12 +0900,
Matt Lawrence wrote in [ruby-talk:104623]:

I double checked the patch. Then I deleted the entire source directory
and recreated it, copied in the patched configure.in, ran autoconf, ran
configure and then ran make. Same problem. Am I doing something wrong?

Sorry, TRY_LINK variable hasn't been exported. Apply this
patch too.

Index: configure.in

···

===================================================================
RCS file: /pub/cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.212.2.12
diff -u -2 -p -r1.212.2.12 configure.in
--- configure.in 26 Jun 2004 02:05:54 -0000 1.212.2.12
+++ configure.in 26 Jun 2004 02:22:10 -0000
@@ -952,4 +952,5 @@ AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
AC_SUBST(RPATHFLAG)
+AC_SUBST(TRY_LINK)

dln_a_out_works=no

--
Nobu Nakada

Sorry, TRY_LINK variable hasn't been exported. Apply this
patch too.

That seemed to work, but now I'm getting this:

head ext/socket/mkmf.log

have_library: checking for t_open() in -lnsl... -------------------- no

"gcc -brtl -bI:/usr/src/ruby-1.8.1/ruby.imp -bM:SRE -T512 -H512
-oconftest -I/usr/src/ruby-1.8.1 -I/usr/src/ruby-1.8.1 -g -O2 conftest.c
-L"/usr/src/ruby-1.8.1" -L"/usr/local/lib" -lruby-static -lnsl -ldl
-lcrypt -lm -lc"
gcc: couldn't run `M:SRE-gcc-3.3.3': No such file or directory
checked program was:

···

On Sat, 26 Jun 2004 nobu.nokada@softhome.net wrote:

Hi,

At Sat, 26 Jun 2004 11:58:59 +0900,
Matt Lawrence wrote in [ruby-talk:104625]:

gcc: couldn't run `M:SRE-gcc-3.3.3': No such file or directory

Sounds like that something isn't installed properly. Can you
compile simple example?

$ echo 'int main() {}' > conftest.c
$ gcc -brtl -bM:SRE -oconftest conftest.c

···

--
Nobu Nakada

Nope, same error. Finding another prebuilt gcc for AIX 5.2 is going to be
a pain. Unless, of course, I'm only missing some other package. What do
you think?

-- Matt
Weinberg's Law: If builders built buildings the way that programmers wrote
programs, the first woodpecker that came along would destroy civilization.

···

On Sat, 26 Jun 2004 nobu.nokada@softhome.net wrote:

Matt Lawrence wrote in [ruby-talk:104625]:
> gcc: couldn't run `M:SRE-gcc-3.3.3': No such file or directory

Sounds like that something isn't installed properly. Can you
compile simple example?

$ echo 'int main() {}' > conftest.c
$ gcc -brtl -bM:SRE -oconftest conftest.c