Forum: Ruby-dev [ruby-trunk - Bug #10384] [Closed] Fiddle::DLError: unknown symbol "Init_objspace" during Fiddle::Te

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2015-01-05 16:17
(Received via mailing list)
Issue #10384 has been updated by Nobuyoshi Nakada.

Status changed from Open to Closed
% Done changed from 0 to 100

Applied in changeset r49157.

test_handle.rb: use -test-/dln/empty

* test/fiddle/test_handle.rb (test_NEXT): use -test-/dln/empty
  which is always a shared object and is not used by others.
  [ruby-dev:48629] [Bug #10384]

Bug #10384: Fiddle::DLError: unknown symbol "Init_objspace" during
Fiddle::TestHandle#test_NEXT and Fiddle::TestHandle#test_static_sym on

* Author: Naohisa Goto
* Status: Closed
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby 2.2.0dev (2014-10-14) [sparc64-solaris2.10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
Solarisにて、make test-all中に以下のエラーが発生することが多くなっています。

  2) Error:
DL::DLError: unknown symbol "Init_objspace"
    /XXXXX/test/dl/test_handle.rb:34:in `sym'
    /XXXXX/test/dl/test_handle.rb:34:in `rescue in test_static_sym'
    /XXXXX/test/dl/test_handle.rb:27:in `test_static_sym'

  4) Error:
Fiddle::DLError: unknown symbol "Init_objspace"
    /XXXXX/test/fiddle/test_handle.rb:171:in `[]'
    /XXXXX/test/fiddle/test_handle.rb:171:in `rescue in test_NEXT'
    /XXXXX/test/fiddle/test_handle.rb:144:in `test_NEXT'

  5) Error:
Fiddle::DLError: unknown symbol "Init_objspace"
    /XXXXX/test/fiddle/test_handle.rb:41:in `sym'
    /XXXXX/test/fiddle/test_handle.rb:41:in `rescue in test_static_sym'
    /XXXXX/test/fiddle/test_handle.rb:34:in `test_static_sym'

Fiddle::Handle.sym および Fiddle::Handle.[] (DL::Handle.sym なども同様)は内部で
RTLD_NEXT を使用しています。
Solarisのman dlsym(3C) より引用します。

     RTLD_NEXT       Instructs dlsym() to search  for  the  named
                     symbol  in the objects that were loaded fol-
                     lowing the object  from  which  the  dlsym()
                     call is being made.

Solarisのdlsymでは、handleに RTLD_NEXT
このため、require "objspace" による の読み込みが require "fiddle"


 % ruby -e 'require "objspace"; require "fiddle"; p
-e:1:in `sym': unknown symbol "Init_objspace" (Fiddle::DLError)
        from -e:1:in `<main>'
 % ruby -e 'require "fiddle"; require "objspace"; p

単純にgrepすると、require "objspace" は以下で行われています。

 test/dl/test_handle.rb:        require 'objspace'
 test/fiddle/test_closure.rb:      require 'objspace'
 test/fiddle/test_handle.rb:        require 'objspace'
 test/lib/profile_test_all.rb:require 'objspace'
 test/objspace/test_objspace.rb:require "objspace"
 test/ruby/test_file_exhaustive.rb:    require "objspace"

This topic is locked and can not be replied to.