Project

General

Profile

Bug #1914

ruby-1.9.1-p243 failed to build from source on aix 5.3 with gcc 4.2.0

Added by rubisher (Joel Soete) about 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby-1.9.1-p243
Backport:
[ruby-dev:39052]

Description

=begin
Hello all,

I very fall in love of ruby programming language when I discover it some years ago (iirc it was release 1.6) and when in a few days, even thought I am not a programmer, I was able to rewrite in ruby a ksh script of mine about 10 time faster ;<)

Today I would like to use it on the platform Aix which I am now in charge to manage as system engineer.

I reach to compile release 1.8.7-p160 and later but without kernel pthread support, also would I like to test 1.9 if it better support those native pthread.

Unfortunately, it failed to build with this first issue:
/opt/freeware/bin/gcc -fno-strict-aliasing -gxcoff -fsigned-char -D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wall -Wno-parentheses
-I. -I.ext/include/powerpc-aix5
.3.0.0 -I./include -I. -DRUBY_EXPORT -D_LINUX_SOURCE_COMPAT -o dmyext.o -c dmyext.c
/opt/freeware/bin/gcc -fno-strict-aliasing -gxcoff -fsigned-char -D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wall -Wno-parentheses
-I. -I.ext/include/powerpc-aix5
.3.0.0 -I./include -I. -DRUBY_EXPORT -D_LINUX_SOURCE_COMPAT -o encoding.o -c encoding.c
make: Circular prelude.c <- .rbconfig.time dependency dropped.
make: Circular prelude.c <- miniruby dependency dropped.
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb -I. -rrbconfig ./tool/compile_prelude.rb ./prelude.rb ./enc/prelude.rb .
/gem_prelude.rb prelude.c
make: ./miniruby: Command not found
make: *** [prelude.c] Error 127

With Google I read this thread:
http://www.ruby-forum.com/topic/135197
well the patch aix.diff it contains and apply:

diff -Naur ruby-1.9.1-p243.orig/common.mk ruby-1.9.1-p243/common.mk
--- ruby-1.9.1-p243.orig/common.mk 2009-05-04 12:31:23.000000000 +0000
+++ ruby-1.9.1-p243/common.mk 2009-08-07 13:04:27.000000000 +0000
@@ -160,8 +160,8 @@
@$(RM) $@
$(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDF
LAGS)

-ruby.imp: $(OBJS)

  • @$(NM) -Pgp $(OBJS) | awk 'BEGIN{print "#!"}; $$2~/[BD]$$/{print $$1}' | sort -u -o $@ +ruby.imp: $(COMMONOBJS)
  • @$(NM) -Pgp $(COMMONOBJS) | awk 'BEGIN{print "#!"}; $$2~/[BD]$$/{print $$1}' | sort -u -o $@

install: install-nodoc $(RDOCTARGET)
install-all: install-nodoc install-doc

which help me to go a bit ahead but finaly failed as follow:

make[1]: Entering directory `/lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl'
/opt/freeware/bin/gcc -I. -I../../.ext/include/powerpc-aix5.3.0.0 -I../.././include -I../.././ext/dl -DRUBY_EXTCONF_H=\"extconf.h\"
-D_LINUX_SOURCE_COMPAT -D_LARGE_FILES=1 -fno-strict-aliasing -gxcoff -fsigned-char -D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wa
ll -Wno-parentheses -fno-defer-pop -fno-omit-frame-pointer -o cfunc.o -c cfunc.c
generating callback.h
/lppdir/stage/ruby1.9/ruby-1.9.1-p243/.ext/powerpc-aix5.3.0.0/enc/encdb.so: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [powerpc-aix5.3.0.0]

-- control frame ----------
c:0003 p:-134605378 s:0006 b:0006 l:000005 d:000005 TOP

c:0002 p:-134599490 s:0004 b:0004 l:000003 d:000003 TOP

c:0001 p:0000 s:0002 b:0002 l:00265c d:00265c TOP


-- Ruby level backtrace information-----------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make[1]: *** [callback.h] IOT/Abort trap (core dumped)
make[1]: Leaving directory `/lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl'
make: *** [mkmain.sh] Error 1

Well I also read this thread related also related to 1.9 but with xlC compiler:
http://www.ruby-forum.com/topic/180444

but as I am not a programmer, I am not familiar with any gdb or dbx and I doesn't understand how Graham reach to compile ruby1.9.

That said, I noticed another error in the make step:
/opt/freeware/bin/gcc -shared -Wl,-G -Wl,-bnoentry -Wl,-bE:ruby.imp -Wl,-brtl -Wl,-blibpath:/opt/mce-pware/lib:/usr/lib:/lib dln.
o encoding.o prelude.o array.o bi
gnum.o class.o compar.o complex.o dir.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o
math.o numeric.o object.o pack.o
parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o sig
nal.o sprintf.o st.o strftime.o s
tring.o struct.o time.o transcode.o util.o variable.o version.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_
ascii.o unicode.o utf_8.o newline
.o flock.o strlcpy.o strlcat.o dmyext.o -lm -lc -o libruby.so.1.9.1
/usr/bin/w64: Not a recognized flag: L
Usage: /usr/bin/w64 [ -hlsuwX ] [ user ]
make: [libruby.so.1.9.1] Error 1 (ignored)

I was worry why 'w' was used here and see that it comes from Makefile:
Makefile
$(LIBRUBY_SO):
@-$(PRE_LIBRUBY_UPDATE)
$(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
-$(OBJCOPY) -w -L 'Init_*' $@
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
File.symlink "$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true

but I didn't install binutils (I read somewhere it wasn't recommended) so:

SET_LC_MESSAGES = env LC_MESSAGES=C
OBJDUMP =
OBJCOPY =
VCS = echo cannot
VCSUP = $(VCS)

But this error is 'ignored' so may be not related to the previous "[BUG] Segmentation fault" above, though?

That said, all comments, advise will be welcome.

Thanks in advance,
J.
=end

#1

Updated by yugui (Yuki Sonoda) about 11 years ago

=begin
Redmine管理用プロジェクトに報告されてしまったので転送します。

---------- 転送メッセージ ----------
From: Joel Soete redmine@ruby-lang.org
日付: 2009/08/09 7:55
件名: [redmine4ruby-lang:253] [Bug #1914] ruby-1.9.1-p243 failed to
build from source on aix 5.3 with gcc 4.2.0
To: redmine4ruby-lang@qwik.jp

Bug #1914: ruby-1.9.1-p243 failed to build from source on aix 5.3 with gcc 4.2.0
http://redmine.ruby-lang.org/issues/show/1914

起票者: Joel Soete
ステータス: Open, 優先度: Normal

Hello all,

I very fall in love of ruby programming language when I discover it
some years ago (iirc it was release 1.6) and when in a few days, even
thought I am not a programmer, I was able to rewrite in ruby a ksh
script of mine about 10 time faster ;<)

Today I would like to use it on the platform Aix which I am now in
charge to manage as system engineer.

I reach to compile release 1.8.7-p160 and later but without kernel
pthread support, also would I like to test 1.9 if it better support
those native pthread.

Unfortunately, it failed to build with this first issue:
/opt/freeware/bin/gcc -fno-strict-aliasing -gxcoff -fsigned-char
-D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wall -Wno-parentheses
-I. -I.ext/include/powerpc-aix5
.3.0.0 -I./include -I. -DRUBY_EXPORT -D_LINUX_SOURCE_COMPAT -o
dmyext.o -c dmyext.c
/opt/freeware/bin/gcc -fno-strict-aliasing -gxcoff -fsigned-char
-D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wall -Wno-parentheses
-I. -I.ext/include/powerpc-aix5
.3.0.0 -I./include -I. -DRUBY_EXPORT -D_LINUX_SOURCE_COMPAT -o
encoding.o -c encoding.c
make: Circular prelude.c <- .rbconfig.time dependency dropped.
make: Circular prelude.c <- miniruby dependency dropped.
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb -I.
-rrbconfig ./tool/compile_prelude.rb ./prelude.rb ./enc/prelude.rb .
/gem_prelude.rb prelude.c
make: ./miniruby: Command not found
make: *** [prelude.c] Error 127

With Google I read this thread:
http://www.ruby-forum.com/topic/135197
well the patch aix.diff it contains and apply:

diff -Naur ruby-1.9.1-p243.orig/common.mk ruby-1.9.1-p243/common.mk
--- ruby-1.9.1-p243.orig/common.mk 2009-05-04 12:31:23.000000000 +0000
+++ ruby-1.9.1-p243/common.mk 2009-08-07 13:04:27.000000000 +0000
@@ -160,8 +160,8 @@
@$(RM) $@
$(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
$(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDF
LAGS)

-ruby.imp: $(OBJS)

  • @$(NM) -Pgp $(OBJS) | awk 'BEGIN{print "#!"}; $$2~/[BD]$$/{print $$1}' | sort -u -o $@ +ruby.imp: $(COMMONOBJS)
  • @$(NM) -Pgp $(COMMONOBJS) | awk 'BEGIN{print "#!"}; $$2~/[BD]$$/{print $$1}' | sort -u -o $@

install: install-nodoc $(RDOCTARGET)
install-all: install-nodoc install-doc

which help me to go a bit ahead but finaly failed as follow:

make[1]: Entering directory `/lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl'
/opt/freeware/bin/gcc -I. -I../../.ext/include/powerpc-aix5.3.0.0
-I../.././include -I../.././ext/dl -DRUBY_EXTCONF_H=\"extconf.h\"
-D_LINUX_SOURCE_COMPAT -D_LARGE_FILES=1 -fno-strict-aliasing -gxcoff
-fsigned-char -D_LINUX_SOURCE_COMPAT -D_REENTRANT -O2 -g -Wa
ll -Wno-parentheses -fno-defer-pop -fno-omit-frame-pointer -o
cfunc.o -c cfunc.c
generating callback.h
/lppdir/stage/ruby1.9/ruby-1.9.1-p243/.ext/powerpc-aix5.3.0.0/enc/encdb.so:
[BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [powerpc-aix5.3.0.0]

-- control frame ----------
c:0003 p:-134605378 s:0006 b:0006 l:000005 d:000005 TOP
c:0002 p:-134599490 s:0004 b:0004 l:000003 d:000003 TOP
c:0001 p:0000 s:0002 b:0002 l:00265c d:00265c TOP


-- Ruby level backtrace information-----------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make[1]: *** [callback.h] IOT/Abort trap (core dumped)
make[1]: Leaving directory `/lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl'
make: *** [mkmain.sh] Error 1

Well I also read this thread related also related to 1.9 but with xlC compiler:
http://www.ruby-forum.com/topic/180444

but as I am not a programmer, I am not familiar with any gdb or dbx
and I doesn't understand how Graham reach to compile ruby1.9.

That said, I noticed another error in the make step:
/opt/freeware/bin/gcc -shared -Wl,-G -Wl,-bnoentry -Wl,-bE:ruby.imp
-Wl,-brtl -Wl,-blibpath:/opt/mce-pware/lib:/usr/lib:/lib dln.
o encoding.o prelude.o array.o bi
gnum.o class.o compar.o complex.o dir.o enum.o enumerator.o error.o
eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o
math.o numeric.o object.o pack.o
parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o
regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o sig
nal.o sprintf.o st.o strftime.o s
tring.o struct.o time.o transcode.o util.o variable.o version.o
compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_
ascii.o unicode.o utf_8.o newline
.o flock.o strlcpy.o strlcat.o dmyext.o -lm -lc -o libruby.so.1.9.1
/usr/bin/w64: Not a recognized flag: L
Usage: /usr/bin/w64 [ -hlsuwX ] [ user ]
make: [libruby.so.1.9.1] Error 1 (ignored)

I was worry why 'w' was used here and see that it comes from Makefile:
Makefile
$(LIBRUBY_SO):
@-$(PRE_LIBRUBY_UPDATE)
$(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
-$(OBJCOPY) -w -L 'Init_*' $@
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if
File.exist? link; \
File.symlink
"$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true

but I didn't install binutils (I read somewhere it wasn't recommended) so:

SET_LC_MESSAGES = env LC_MESSAGES=C
OBJDUMP =
OBJCOPY =
VCS = echo cannot
VCSUP = $(VCS)

But this error is 'ignored' so may be not related to the previous
"[BUG] Segmentation fault" above, though?

That said, all comments, advise will be welcome.

Thanks in advance,
J.


http://redmine.ruby-lang.org

--
archive-> http://qwik.jp/redmine4ruby-lang/145.html
ML-> redmine4ruby-lang@qwik.jp

--
Yugui
yugui.ps@gmail.com
http://yugui.jp

=end

#2

Updated by rubisher (Joel Soete) about 11 years ago

=begin
Hello all,

Strange issue for me?

I just read the content of the ext/dl/Makefile and try to write a script which would be supposed to make the same work, let me submit you:
#!/bin/ksh
set -x

cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl

arch="powerpc-aix5.3.0.0"
topdir="../.."
top_srcdir="${topdir}/."
srcdir="${top_srcdir}/ext/dl"
extout="${topdir}/.ext"
RUBYOPT="-r${top_srcdir}/ext/purelib.rb"

echo "First Test"
ruby="${topdir}/miniruby -I'${topdir}' -I'${top_srcdir}/lib' -I'${extout}/${arch}' -I'${extout}/common' -I./- -I'${top_srcdir}/ext' -rpurelib.rb"

RUBY="${ruby}"

${RUBY} ${srcdir}/mkcallback.rb ${srcdir}/dl.h

exit 0

and the result was:

  • cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl
  • arch=powerpc-aix5.3.0.0
  • topdir=../..
  • top_srcdir=../../.
  • srcdir=../.././ext/dl
  • extout=../../.ext
  • RUBYOPT=-r../.././ext/purelib.rb
  • echo First Test First Test
  • ruby=../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -rpurelib.rb
  • RUBY=../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -rpurelib.rb
  • ../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -rpurelib.rb ../.././ext/dl/mkcallback.rb ../.././ext/dl/dl.h ../../miniruby:0:in `require': no such file to load -- purelib.rb (LoadError)

Well, no big deal let try another approach: give additional path to the required module:
#!/bin/ksh
set -x

cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl

arch="powerpc-aix5.3.0.0"
topdir="../.."
top_srcdir="${topdir}/."
srcdir="${top_srcdir}/ext/dl"
extout="${topdir}/.ext"
RUBYOPT="-r${top_srcdir}/ext/purelib.rb"

echo "Second Test"
ruby="${topdir}/miniruby -I'${topdir}' -I'${top_srcdir}/lib' -I'${extout}/${arch}' -I'${extout}/common' -I./- -I'${top_srcdir}/ext' ${RUBYOPT}"

RUBY="${ruby}"

${RUBY} ${srcdir}/mkcallback.rb ${srcdir}/dl.h

exit 0

now the result is:

  • cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl
  • arch=powerpc-aix5.3.0.0
  • topdir=../..
  • top_srcdir=../../.
  • srcdir=../.././ext/dl
  • extout=../../.ext
  • RUBYOPT=-r../.././ext/purelib.rb
  • echo Second Test Second Test
  • ruby=../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -r../.././ext/purelib.rb
  • RUBY=../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -r../.././ext/purelib.rb
  • ../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -r../.././ext/purelib.rb ../.././ext/dl/mkcallback.rb ../.././ext/dl/dl.h
  • exit 0

Ok; that works???

Let me try now to cut&past this last cmdl in another script:
#!/bin/ksh
set -x
cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl

echo "1"
echo ""
../../miniruby -I'../..' -I'../.././lib' -I'../../.ext/powerpc-aix5.3.0.0' -I'../../.ext/common' -I./- -I'../.././ext' -r../.././ext/purelib.rb ../.././ext/dl/mkcallback.rb ../.././ext/dl/dl.h

hey, that's do again SEGFAULT:

  • cd /lppdir/stage/ruby1.9/ruby-1.9.1-p243/ext/dl
  • echo 1 1
  • echo

  • ../../miniruby -I../.. -I../.././lib -I../../.ext/powerpc-aix5.3.0.0 -I../../.ext/common -I./- -I../.././ext -r../.././ext/purelib.rb ../.././ext/dl/mkcallback.rb ../.././ext/dl/dl.h
    /lppdir/stage/ruby1.9/ruby-1.9.1-p243/.ext/powerpc-aix5.3.0.0/enc/encdb.so: [BUG] Segmentation fault
    ruby 1.9.1p243 (2009-07-16 revision 24175) [powerpc-aix5.3.0.0]

-- control frame ----------
c:0003 p:-134605206 s:0006 b:0006 l:000005 d:000005 TOP

c:0002 p:-134599586 s:0004 b:0004 l:000003 d:000003 TOP

c:0001 p:0000 s:0002 b:0002 l:0000cc d:0000cc TOP


-- Ruby level backtrace information-----------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

../Cb2[7]: 499808 IOT/Abort trap(coredump)

Tbh, that's the first time I encountered such difference of behaviour and so very curious to understand?

Thanks again for your attention,
J.

PS: that said, once the callback.h file is created as per step2 above, the make can continue (even though it failed again into openssl build because it doesn't find pt and len member in structure RString, but that's another story.)
=end

#3

Updated by rubisher (Joel Soete) about 11 years ago

=begin
Yes, I reach to get rid of 'Circular dependencies', issue with miniruby which failed to build callback* files and finaly build ruby-1.9.1-p243 :<)

I will post the results of my investigation soon.

Cheers,
J.

=end

#4

Updated by rubisher (Joel Soete) about 11 years ago

=begin
Hello all,

Here are the tips I implement for my latest successful build.

After reading in more details http://www.ibm.com/developerworks/aix/library/au-gnu.html and associated http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf, I figure out that in fact we would be be to build shared lib and exec with -bexpall linker option in place of -bE:ruby.imp (on AIX we have to use the native linker) and those patches applied after './configure' help me to get rid of "circular dependency"

--- ruby-1.9.1-p243-aix0/Makefile~ 2009-08-31 15:00:17.000000000 +0000
+++ ruby-1.9.1-p243-aix0/Makefile 2009-08-31 15:00:24.000000000 +0000
@@ -51,12 +51,12 @@
CPPFLAGS = -D_LINUX_SOURCE_COMPAT $(DEFS) ${cppflags}
LDFLAGS = $(CFLAGS) -L/usr/lib -L/opt/mce-pware/lib -L.
EXTLDFLAGS =
-XLDFLAGS = -Wl,-bE:ruby.imp -Wl,-brtl -Wl,-blibpath:/opt/mce-pware/lib:/usr/lib:/lib $(EXTLDFLAGS)
+XLDFLAGS = -Wl,-brtl -Wl,-bexpall -Wl,-bnoipath $(EXTLDFLAGS)
EXTLIBS =
LIBS = -lpthread -lrt -ldl -lcrypt -lm $(EXTLIBS)
MISSING = ${LIBOBJDIR}flock.o ${LIBOBJDIR}strlcpy.o ${LIBOBJDIR}strlcat.o
LDSHARED = $(CC) -shared -Wl,-G
-DLDFLAGS = -Wl,-bnoentry -Wl,-bE:ruby.imp -Wl,-brtl -Wl,-blibpath:/opt/mce-pware/lib:/usr/lib:/lib $(EXTLDFLAGS)
+DLDFLAGS = -Wl,-bexpall -Wl,-bnoentry -Wl,-bnoipath $(EXTLDFLAGS)
SOLIBS = -lm -lc
MAINLIBS =
ARCHMINIOBJS = dln.o
@@ -108,8 +108,8 @@
ASFLAGS =
IFCHANGE = $(srcdir)/tool/ifchange
SET_LC_MESSAGES = env LC_MESSAGES=C
-OBJDUMP =
-OBJCOPY =
+OBJDUMP = :
+OBJCOPY = :
VCS = echo cannot
VCSUP = $(VCS)

@@ -132,7 +132,7 @@

miniruby$(EXEEXT):
@-if test -f $@; then mv -f $@ $@.old; $(RM) $@.old; fi

  • $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE) $(LIBS) $(OUTFLAG)$@
  • $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(LIBS) $(OUTFLAG )$@

$(PROGRAM):
@$(RM) $@
=== <> ===
(please note that I didn't find any relevant objcopy for aix, that's the reason of second hunk)

--- ruby-1.9.1-p243-aix0/common.mk~ 2009-05-04 12:31:23.000000000 +0000
+++ ruby-1.9.1-p243-aix0/common.mk 2009-08-28 20:43:54.000000000 +0000
@@ -139,7 +139,7 @@

$(PREP): $(MKFILES)

-miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE)
+miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT)

GORUBY = go$(RUBY_INSTALL_NAME)
golf: $(LIBRUBY) $(GOLFOBJS)
=== <> ===

All other problems encountered are related to native AIX linker we have to use.

First, to build this release 1.9 we have to have another executable ruby (here I use latest 1.8) which by default is generally build with '-L. -L/Where/ruby_lib/is_installed' which means that the '.' (i.e. the current) dir is where ruby (here 1.8) will look for libruby.so (see 'dump -Hv /your_full_path/ruby'). So once make has finished to build the new libruby.so and when it will call baseruby this one will use this new lib better then its base lib. Obviously, its possible to use --program-suffix=1.9 configure option but it's also easy to apply follwing configure patch:
--- ruby-1.9.1-p243/configure.orig 2009-07-17 14:44:35.000000000 +0000
+++ ruby-1.9.1-p243/configure 2009-08-13 15:38:51.000000000 +0000
@@ -22210,7 +22210,7 @@
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
fi

-LDFLAGS="-L. $LDFLAGS"
+LDFLAGS="$LDFLAGS -L."

RDOCTARGET=""
=== <> ===

Second, as previously mentioned, miniruby failed to build 'callback' (and some other) section simply because it doesn't know where to find the new libruby. Even with previous patch, (sorry I didn't take trace of dump -Hv miniruby but truss me) it will look first to /Where/you_want_to_install/libruby.so then in the currrent dir (iirc ./ext/dl), so either it will not find any libruby.so or it will find the wrong one (here the lib of baseruby 1.8). Fortunately the env var LIBPATH (the equivalent of LD_LIBRARY_PATH) can help and following diff help me for all miniruby usage:
--- ruby-1.9.1-p243-aix0/ext/extmk.rb~ 2009-03-03 11:40:11.000000000 +0000
+++ ruby-1.9.1-p243-aix0/ext/extmk.rb 2009-08-28 21:47:42.000000000 +0000
@@ -338,7 +338,7 @@
elsif sep = config_string('BUILD_FILE_SEPARATOR')
$ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT
else

  • $ruby = '$(topdir)/miniruby' + EXEEXT
  • $ruby = 'LIBPATH=$(topdir) $(topdir)/miniruby' + EXEEXT end $ruby << " -I'$(topdir)'" unless CROSS_COMPILING === <> ===

Finaly, ruby itself failed to build because the native ld find first the baseruby libruby.so in place of the new one but here I don't find better then using --program-suffix=1.9

May be could it be possible to use such additional envlibpath = LIBPATH=. to prefix $(PROGRAM) build, though?

Well, this is just a draft for a fix but as I am not a programmer also would I need help to build a final fix.

Thanks in advance for additional help,
R.

=end

#5

Updated by yugui (Yuki Sonoda) about 11 years ago

  • Target version set to 1.9.2
  • ruby -v set to ruby-1.9.1-p243

=begin

=end

#6

Updated by kanemoto (Yutaka Kanemoto) about 11 years ago

=begin
金本です。

2009/9/10 Nobuyoshi Nakada nobu@ruby-lang.org:

なかだです。
これだと、LIBRUBY_DLDFLAGSには-bexpallがついて-bE:${ARCHFILE}が
含まれなくなるように見えます。
すみません。見落としていました。
添付のパッチでは削ってあります。

gccなら-gxcoffを指定していますが、man gccではなんとなくどこで
も-ggdbを指定しておけばよさそうな気もしなくもありません。
なぜかdbxしか頭になかったので、ためしにgdbをコンパイルしてみたのですが、
コンパイルが失敗しました。
-ggdbでコンパイルしてdbxから読んでみたのですが、ぜんぜん情報取れませんでした。

ちなみに、-bEに指定するシンボルって、データだけじゃなくてテキス
トについても有効なんでしょうか。今のところテキストシンボルは入れ
ていないはずなので、もしかしたらInitつきを入れても入れなくても
アクセスできてしまうとか。
簡単なプログラム書いて試したのですが、オプションによって
そうなる場合があるようです。
すくなくともldの-Gというオプションつきでライブラリを作るとエクスポートしていない関数とは
リンクできませんでした。

1.9.1p243は単にコンパイルしても
make: Circular .rbconfig.time <- miniruby dependency dropped.
make: ./miniruby: Command not found
make: *** [.rbconfig.time] Error 127
がでてしまって#2064のところまでいかないので、何かいじったあとの
現象のようです。
このあと別便(多少大きいので私信で)でnmの出力を参考のために送らせていただきます。
あたまに.がついたものを抜かないとワーニングがでまくってしまいます。
いただいたパッチを少し変更してとりあえずコンパイルが終了したものを送ります。
シンボルのタイプはここに列挙されてあります。
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds4/nm.htm

--
Yutaka KANEMOTO
http://d.hatena.ne.jp/kinpoco/

Attachment: exp.diff
=end

#7

Updated by kanemoto (Yutaka Kanemoto) about 11 years ago

=begin
金本と申します。
返答が遅くなってどうもすみません。

まず、このdlopenの件と次のシンボルの話はわけるべきではないかと。
はい。おっしゃるとおりです。
先日送ったパッチにも本題と外れる部分(-gxcoffとか)が入っていて
ご面倒をおかけしてどうもすみませんでした。

http://en.wikipedia.org/wiki/IBM_AIX#Versions を見ると、4.1は
1994年ですね。
いくつかほかのソフトのソースを見てみたのですが、
いくつかのソフトではAIXでdlopenをつかっていないのがありました。
4.3とそれ以前を分けているようなのもありました。
どうも古いAIXを捨てるのが忍びない気がしてきたので、
ちょっと考えてみようと思います。

また、標準のCのincludeファイルからインクルードされているファイルで、
#define _AIXVERSION_430 1
#define _AIXVERSION_431 1
#define _AIXVERSION_434 1
#define _AIXVERSION_510 1
#define _AIXVERSION_520 1
#define _AIXVERSION_530 1
#define _AIXVERSION_610 1
というのがあったので、古いのと動作を変えることもそんなに難しくなさそうです。

それと、[ruby-talk:331649]のようなこともdlopenを使うようにすれば
不要なのでしょうか。
encoding.oの関数がruby.expにないと、手元ではminirubyがなぜかハングしました。
なので、やっぱりエクスポートされていないとまずそうです。
質問の意図をわかっていますでしょうか?

--
Yutaka KANEMOTO
http://d.hatena.ne.jp/kinpoco/

=end

#8

Updated by rubisher (Joel Soete) about 11 years ago

=begin
Hello all,

Sorry but I couldn't test all stuff published on this forum http://www.ruby-forum.com/topic/193040#841466 just because am I out of office for some holiday ;<)

That said, I couldn't read comments because my FireFox just shows me garbage (I do have missed some language support, though) even though I don't read Japanese at all (very sorry).

Any way, I guess to have understand that making some '.exp' file is requested even thought I reach to build ruby without this file?

If I well understand this topic, I read this interesting thread imho:
http://gcc.gnu.org/ml/gcc-help/2003-07/msg00082.html
where the mentioned script:
nm -BCpg *.o | awk '{ if ((($2 == "T") || ($2 == "D") || ($2 == "B")) && (substr($3,1,1) != ".")) { print $3 } }' | sort -u > icu.exp

seems to do the same job as the 'CreateExportList' of xlc (the native AIX C compiler).

Otoh as much as I can read there are a lot of different way to create this '.exp' file and python project have this "Modules/makexp_aix" script in its src tree for this purpose.

Thanks a lot, I will try to comeback asap with test of different suggested patches.

J.
=end

#9

Updated by naruse (Yui NARUSE) about 11 years ago

  • Status changed from Open to Assigned
  • Assignee set to kanemoto (Yutaka Kanemoto)

=begin

=end

#10

Updated by kanemoto (Yutaka Kanemoto) over 10 years ago

  • Status changed from Assigned to Closed

=begin
Some issues reported here is fixed by r24482 and r25124.
At least, building ruby(trunk) is finished successfully in my env(AIX 5.3).

By the way, for this 'w' problem:

I was worry why 'w' was used here and see that it comes from Makefile:
please install coreutils to avoid this problem at this point.
ftp://ftp.software.ibm.com:/aix/freeSoftware/aixtoolbox/RPMS/ppc/coreutils
AIX's install command does not have -d option, and that caused this message.

If crash issue still persists, please reopen this ticket with:

  1. configure options
  2. gcc version
  3. oslevel -s

Thanks and best regards,
Yutaka Kanemoto

=end

Also available in: Atom PDF