Project

General

Profile

Bug #2638

ruby-1.9.1-p37[68] build on aix5.3 with gcc-4.2 failed to run for me because it ignores where libgcc is located.

Added by rubisher (Joel Soete) about 9 years ago. Updated almost 8 years ago.

Status:
Assigned
Priority:
Normal
ruby -v:
1.9.1-p37[68]
[ruby-core:27757]

Description

=begin
Hello all,

This issue is very tricky, though.

For my build, I am using tools of "AIX Toolbox for Linux Applications" like gcc-4.2, make, ... which are located by default into prefix dir: "/opt/freeware".

But my own builds like ruby stand into my prefix dir: /opt/mce-pware.

Now that I describe my way of work, after I my build of ruby-1.9.1-p37[68] with configure --prefix=/opt-mce-pware, it failed to run because it needs libgcc but ignoring where this is installed.

This lib comes from "Aix Toolbox" libgcc-4.2.0-3.aix5.3.ppc.rpm which doesn't install links into /usr/lib. Obviously, I can create this links but I worry of what wouls happen for my ruby if I update libgcc?

On the other hand, I have a look to the search path of ruby with "# dump -Hv ./ruby" and this search path just contains "/opt/mce-pware/lib:/usr/lib:/lib".

I could also use "LIBPATH" environment variable and include it in script to wrap ruby cmdl?

I also try to use this "LIBPTAH" to build ruby but it failed to me because my own prefix contains some build of more recent release of tools like gettext also used by make. And unfortunately this break make to run ;<(

So as a first work-around, I create a variable which I name LIBGCCPATH which contains
LIBGCCPATH=$(gcc -print-libgcc-file-name)
LIBGCCPATH=$(dirname $LIBGCCPATH)
export LIBGCCPATH

and hack ruby-1.9.1-p378/configure file like:
--- ruby-1.9.1-p378/configure 2010-01-10 11:36:35.000000000 +0000
+++ ruby-1.9.1-p378-aix0/configure 2010-01-21 07:26:26.000000000 +0000
@@ -10968,7 +10968,7 @@
LDSHARED="$LDSHARED ${linker_flag}-G"
DLDFLAGS='-eInit_$(TARGET)'
XLDFLAGS="${linker_flag}-bE:ruby.imp ${linker_flag}-brtl"

  • XLDFLAGS="$XLDFLAGS ${linker_flag}-blibpath:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
  • XLDFLAGS="$XLDFLAGS ${linker_flag}-blibpath:${prefix}/lib${LIBGCCPATH:+:}${LIBGCCPATH:-}:${LIBPATH:-/usr/lib:/lib}" : ${ARCHFILE="ruby.imp"} TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)' TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)' === <> ===

and it works fine.

May be a better fix would be to create another var like TARGETRUBYLIBPATH which I could custom to my environment (e.g. /opt/mce-paware/lib:${LIBGCCPATH}:/usr/lib:/lib) or if TARGETRUBYLIBPATH is unset, set to LIBPATH for the one who can use it in its environment or if LIBPATH is not define by user this TARGETRUBYLIBPATH would be set to "/usr/lib:/lib"; but this required better knowledge then mine to fix it.

Thanks in advance for further help,
J.
=end

History

#1

Updated by naruse (Yui NARUSE) about 9 years ago

=begin
./configure --with-opt-dir=/opt/mce-pware can help you?

% ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ../../ruby/configure [OPTION]... [VAR=VALUE]...
(snip)
--with-opt-dir=DIR add optional headers and libraries DIR
=end

#2

Updated by yugui (Yuki Sonoda) about 9 years ago

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

=begin

=end

#3

Updated by rubisher (Joel Soete) about 9 years ago

=begin
no luck to me:
root@myserver:/.../ruby-1.9.1-p378-aix0 # ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for
--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']

Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]

By default, make install' will install all the files in
/usr/local/bin', /usr/local/lib' etc. You can specify
an installation prefix other than
/usr/local' using --prefix',
for instance
--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]

Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names

System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]

Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-frame-address use GCC __builtin_frame_address().
--disable-largefile omit support for large files
--enable-pthread use pthread library.
--enable-setreuid use setreuid()/setregid() according to need even if obsolete.
--disable-rpath embed run path into extension libraries.
--enable-shared build a shared library for Ruby.
--disable-install-doc do not install rdoc indexes during install

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-baseruby=RUBY use RUBY as baseruby; RUBY is the pathname of ruby
--without-gcc never use gcc
--with-setjmp-type select setjmp type
--with-valgrind enable valgrind memcheck support.
--with-dln-a-out use dln_a_out if possible
--with-static-linked-ext link external modules statically
--with-ruby-version=STR ruby version string for version specific directories full
--with-sitedir=DIR site libraries in DIR [LIBDIR/ruby/site_ruby]
--with-vendordir=DIR vendor libraries in DIR [LIBDIR/ruby/vendor_ruby]
--with-search-path=DIR specify the additional search path
--with-rubyhdrdir=DIR core headers in DIR
[[INCLUDEDIR/RUBY_BASE_NAME-RUBY_VERSION]]
--with-site-hdrdir=DIR core headers in DIR INCLUDEDIR
--with-vendor-hdrdir=DIR core headers in DIR INCLUDEDIR
--with-mantype=TYPE specify man page type; TYPE is one of man and doc

Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to the package provider.

=== <> ===

Sorry I don't find this configure option?

Thanks anyway,
J.
=end

#4

Updated by naruse (Yui NARUSE) about 9 years ago

=begin
1.9.1's configure --help doesn't have description about --with-opt-dir (r25767) but it actually has option.
So you can use --with-opt-dir, please try it.
=end

#5

Updated by rubisher (Joel Soete) about 9 years ago

=begin
Sorry Sir to disappoint you, first because I don't have direct access to svn ruby trunk (and I would very need it because the configure file of ruby-1.9.1-p378.tar.bz2 doesn't contains anything related to 'opt-dir').
Secondly, because I have no clue how to generate this 'configure' from the svn configure.in.
More over I read from ViewVC http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/configure.in?view=markup that it should request autoconf 2.60 [AC_PREREQ(2.60)] and unfortunately I only have 2.59 release.
And finaly because my job will terminate by the end of week so I will not have more time to finalize this test.

Very sorry,
J.

=end

#6

Updated by naruse (Yui NARUSE) about 9 years ago

=begin
I see, please report it when you can.
=end

#7

Updated by kanemoto (Yutaka Kanemoto) about 9 years ago

=begin
Hello Joel,

Are you using --enable-shared when you run configure?
If so, is it possible to try without --enable-shared?

I was able to recreate this issue with --enable-shared.
And unfortunately, --with-opt-dir was not able to resolve this issue
in my environment.
I think, getting LIBGCCPATH using gcc -print-libgcc-file-name in
configure might be the solution.
If you have any concern, please let me know. I will write a patch, later.

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

=end

#8

Updated by kanemoto (Yutaka Kanemoto) about 9 years ago

=begin
Sorry, it seemed that my issue seemed to be different from yours.
In my env, the file which ruby can not find is libgcc_s.a, not libgcc.a.

Could you tell me exact arguments which you've passed to configure?

On Tue, Jan 26, 2010 at 1:13 AM, Yutaka Kanemoto kinpoco@gmail.com wrote:

Hello Joel,

Are you using --enable-shared when you run configure?
If so, is it possible to try without --enable-shared?

I was able to recreate this issue with --enable-shared.
And unfortunately, --with-opt-dir was not able to resolve this issue
in my environment.
I think, getting LIBGCCPATH using gcc -print-libgcc-file-name in
configure might be the solution.
If you have any concern, please let me know. I will write a patch, later.

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

=end

#9

Updated by rubisher (Joel Soete) about 9 years ago

=begin
Hello Sir,

Please accept my apology, I am always trying to be more accurate in my pr report but here I was a bit disturbe.

So here is my configure options:
./configure \
--prefix=/opt/${Co}pware \
--program-suffix=1.9 \
--libexecdir="\${prefix}/lib/ruby1.9" \
--mandir=/opt/${Co}pware/man \
--infodir=/opt/${Co}pware/info \
--enable-shared

(with variable Co="mce-" as you certainly guess)

That said, # gcc -print-libgcc-file-name
/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/libgcc.a

returns well the full path of libgcc.a but my libgcc_s.a is in the same dir:

# ll /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/
total 7616
drwxr-xr-x 6 root system 4096 Aug 07 06:49 .
drwxr-xr-x 3 root system 256 Mar 25 2008 ..
drwxr-xr-x 7 root system 4096 Aug 07 06:47 include
drwxr-xr-x 3 root system 256 Jul 31 07:11 install-tools
-rw-r--r-- 1 root system 124713 Mar 25 2008 libgcc.a
-rw-r--r-- 1 root system 45584 Mar 25 2008 libgcc_eh.a
-rw-r--r-- 1 root system 125986 Feb 18 2008 libgcc_s.a
-rw-r--r-- 1 root system 27086 Mar 25 2008 libgcov.a
-rwxr-xr-x 1 root system 3376733 Mar 25 2008 libstdc++.a
-rw-r--r-- 1 root system 178720 Mar 25 2008 libsupc++.a
drwxr-xr-x 2 root system 256 Aug 07 06:49 ppc64
drwxr-xr-x 3 root system 256 Aug 07 06:49 pthread

Well it would be more clean to run full 'make test' but after the installation some samples seems to work fine:
# ruby1.9 ./sample/fib.rb
6765

# ruby1.9 ./test/test_timeout.rb
Loaded suite ./test/test_timeout
Started
.
Finished in 0.134635 seconds.

# ruby1.9 ./test/ruby/test_thread.rb
Loaded suite ./test/ruby/test_thread
Started
...............................
Finished in 21.258614 seconds.

31 tests, 101 assertions, 0 failures, 0 errors, 0 skips

1 tests, 1 assertions, 0 failures, 0 errors, 0 skips

Anyway, I already see 2 issues:
- I don't now if it wouldn't be better to use the 'pthread' version of libgcc_s
(/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/pthread)?
- how would I manage a 64bit build:
* normaly I would simply use -m64 gcc compile option to do so;
* but "# gcc -m64 -print-libgcc-file-name" always return same result and not
/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/ppc64?

Thanks a lot for your attention,
J.

=end

#10

Updated by rubisher (Joel Soete) about 9 years ago

=begin
Hello Sir,

Just a small update to tell you how did I also manage some 'make test'.

Because ruby1.9 is not yet installed at the moment of the make test, I have to add the build dir to the lib search path thanks to LIBPATH:
# export LIBPATH="/MyBuildTree/ruby-1.9.1-p378-aix0"

And also because some more mem for some test,
# export LDR_CNTRL=0x80000000

finaly I can grab following results:
Testing.

sample/test.rb:assignment ....................................................................................................................................................................................................................................................................................................................................................................................
sample/test.rb:condition ..
sample/test.rb:if/unless ...
sample/test.rb:case .....
sample/test.rb:while/until ........
sample/test.rb:exception ..........
sample/test.rb:array .......................................
sample/test.rb:hash ...........................
sample/test.rb:iterator ...............................................................................................................
sample/test.rb:float ................................................................................
sample/test.rb:bignum ...............................
sample/test.rb:string & char ..............................................................
sample/test.rb:assignment ..........
sample/test.rb:call ......
sample/test.rb:proc .........
sample/test.rb:signal ..
sample/test.rb:eval .............................
sample/test.rb:system .........
sample/test.rb:const .....
sample/test.rb:clone .....
sample/test.rb:marshal ....
sample/test.rb:pack ....
sample/test.rb:math ..
sample/test.rb:struct ......
sample/test.rb:variable ...........
sample/test.rb:trace ...
sample/test.rb:defined? ............
sample/test.rb:alias ......
sample/test.rb:path .......................
sample/test.rb:gc ....
test succeeded

test_attr.rb ..
test_autoload.rb ..........
test_block.rb .......................................................
test_class.rb ............................................
test_eval.rb ...................................
test_exception.rb .................................
test_finalizer.rb .
test_flip.rb .
test_flow.rb ............................................
test_fork.rb .
test_io.rb ............F.
test_jump.rb .........................
test_literal.rb ....................................................................................................................................................
test_load.rb ..
test_marshal.rb .
test_massign.rb ..................................
test_method.rb ...........................................................................................................................................................................................................................
test_objectspace.rb ...
test_proc.rb .................................bootstraptest.tmp.rb:5:in <main>': ok (RuntimeError)
.
test_struct.rb .
test_syntax.rb .....................................................................................................................................................
test_thread.rb ..............................................
#239 test_io.rb:93:in
block in ':
at_exit { p :foo }

    megacontent = "abc" * 12345678
    #File.open("megasrc", "w") {|f| f << megacontent }

    Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }

    r1, w1 = IO.pipe
    r2, w2 = IO.pipe
    t1 = Thread.new { w1 << megacontent; w1.close }
    t2 = Thread.new { r2.read }
    IO.copy_stream(r1, w2) rescue nil
    r2.close; w2.close
    r1.close; w1.close
    #=> killed by SIGKILL (signal 9)  

FAIL 1/902 tests failed
make: *** [btest-ruby] Error 1

I have to kill 'test_io.rb' because it never end; truss showing me:
[snip]
yield() =
thread_tsleep(0, 0xF0483C84, 0x00000000, 0x30116E38) = 0
thread_waitact(400) = 1
yield() =
thread_tsleep(0, 0xF0483C84, 0x00000000, 0x30116E38) = 0
thread_waitact(400) = 1
yield() =
[snip]

Hope it can help: this certainly my last opportunity of test on this platform,
J.
=end

Also available in: Atom PDF