Project

General

Profile

Bug #11434

test_try_ldflag_invalid_opt fails when ruby is not installed

Added by vo.x (Vit Ondruch) almost 5 years ago. Updated almost 3 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.0.0p645 (2015-04-13) [x86_64-linux]
[ruby-core:<unknown>]

Description

This test fails when building Ruby package:

$ make test-all TESTS="-n /test_try_ldflag_invalid_opt/"
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC -m64
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
    DLDFLAGS = -Wl,-soname,libruby.so.2.0  -fstack-protector  -m64
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm  
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"  -n /test_try_ldflag_invalid_opt/
/builddir/build/BUILD/ruby-2.0.0-p645/test/-ext-/symbol/test_type.rb: cannot load such file -- -test-/symbol
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" -n /test_try_ldflag_invalid_opt/

# Running tests:

[1/1] TestMkmf::TestFlags#test_try_ldflag_invalid_opt = 0.11 s
  1) Error:
test_try_ldflag_invalid_opt(TestMkmf::TestFlags):
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

    /builddir/build/BUILD/ruby-2.0.0-p645/lib/mkmf.rb:434:in `try_do'
    /builddir/build/BUILD/ruby-2.0.0-p645/lib/mkmf.rb:519:in `try_link0'
    /builddir/build/BUILD/ruby-2.0.0-p645/lib/mkmf.rb:534:in `try_link'
    /builddir/build/BUILD/ruby-2.0.0-p645/lib/mkmf.rb:615:in `try_ldflags'
    /builddir/build/BUILD/ruby-2.0.0-p645/test/mkmf/base.rb:145:in `<main>'

Finished tests in 0.824727s, 1.2125 tests/s, 1.2125 assertions/s.
1 tests, 1 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.0.0p645 (2015-04-13) [x86_64-linux]
uncommon.mk:513: recipe for target 'yes-test-all' failed
make: *** [yes-test-all] Error 1

When I link the libruby.so into /usr/lib64/, it passes just fine:

# ln -sf /builddir/build/BUILD/ruby-2.0.0-p645/libruby.so /usr/lib64/

$ make test-all TESTS="-n /test_try_ldflag_invalid_opt/"
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC -m64
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
    DLDFLAGS = -Wl,-soname,libruby.so.2.0  -fstack-protector  -m64
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm  
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"  -n /test_try_ldflag_invalid_opt/
/builddir/build/BUILD/ruby-2.0.0-p645/test/-ext-/symbol/test_type.rb: cannot load such file -- -test-/symbol
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" -n /test_try_ldflag_invalid_opt/

# Running tests:

Finished tests in 0.841411s, 1.1885 tests/s, 5.9424 assertions/s.     
1 tests, 5 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.0.0p645 (2015-04-13) [x86_64-linux]

This is probably due to backport of #10821. Interestingly, for Ruby 2.2.2, the test passes just fine. Not sure about Ruby 2.1


Related issues

Related to Ruby master - Bug #10821: mkmf.rb: Incorrect have_devel? test depending on run orderClosed02/03/2015Actions
#1

Updated by vo.x (Vit Ondruch) almost 5 years ago

This is the content of mkmf.log:

"gcc -o conftest -I. -I/builddir/build/BUILD/ruby-2.0.0-p645/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-2.0.0-p645/include/ruby/backward -I/builddir/build/BUILD/ruby-2.0.0-p645/include -I.    -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC conftest.c  -L. -L/usr/lib64 -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic  -m64   -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/bin/ld: cannot find -lruby
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
#2

Updated by vo.x (Vit Ondruch) almost 5 years ago

  • Related to Bug #10821: mkmf.rb: Incorrect have_devel? test depending on run order added

Updated by usa (Usaku NAKAMURA) almost 3 years ago

  • Status changed from Open to Rejected

2.0.0 is out of date

Also available in: Atom PDF