Project

General

Profile

Actions

Bug #18472

closed

rb_w32_map_errno is not found on Ruby-3.1.0

Added by joker1007 (Tomohiro Hashidate) almost 3 years ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
[ruby-dev:51132]

Description

I faced Fiddle::DLError such following.

C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:297:in `import_function': cannot find the function: rb_w32_map_errno() (Fiddle::DLError)
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:170:in `extern'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:112:in `<module:RbWinSock>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:97:in `<module:ServerEngine>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:18:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `require_relative'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `require_relative'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `<module:SocketManager>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:26:in `<module:ServerEngine>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:25:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `<module:ServerEngine>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:18:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `<top (required)>'
	from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `require'
	from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `<top (required)>'
	from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `require'
	from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `<top (required)>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `require'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
	from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!

The cause code is here. (https://github.com/treasure-data/serverengine/blob/4d6dbd3d1b4e1af88cc2593b5b19cf0f6da7d5dd/lib/serverengine/winsock.rb#L112)

  module RbWinSock
    extend Fiddle::Importer

    dlload "kernel32"
    extern "int GetModuleFileNameA(int, char *, int)"
    extern "int CloseHandle(int)"

    ruby_bin_path_buf = Fiddle::Pointer.malloc(1000)
    GetModuleFileNameA(0, ruby_bin_path_buf, ruby_bin_path_buf.size)

    ruby_bin_path = ruby_bin_path_buf.to_s.gsub(/\\/, '/')
    ruby_dll_paths = File.dirname(ruby_bin_path) + '/*msvcr*ruby*.dll'
    ruby_dll_path = Dir.glob(ruby_dll_paths).first
    dlload ruby_dll_path

    extern "int rb_w32_map_errno(int)"

On 3.0.x, this test is passed.

Moreover, I don't find any changes about rb_w32_map_errno from 3.0.3 to 3.1.0.

It is strange behavior. It may be a bug in Ruby-3.1.0

Environment

I apologize for the lack of research, as I do not have a Windows environment.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0