Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work on ruby 3.1 x64-mingw-ucrt #114

Closed
kubo opened this issue Jan 13, 2022 · 1 comment · Fixed by #116
Closed

Not work on ruby 3.1 x64-mingw-ucrt #114

kubo opened this issue Jan 13, 2022 · 1 comment · Fixed by #116
Assignees
Labels

Comments

@kubo
Copy link

kubo commented Jan 13, 2022

A bug report was filed at the ruby issue tracker. I think that it is an issue of this repository.
https://bugs.ruby-lang.org/issues/18472

The following code tries to load the ruby dll in the ruby bin directory. However it doesn't work on ruby 3.1 x64 distributed by rubyinstaller.org. That's because the dll name is x64-ucrt-ruby310.dll and doesn't match *msvcr*ruby*.dll.

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

I think that it will be fixed by the following code:

    require 'rbconfig'
    dlload RbConfig::CONFIG['LIBRUBY_SO']

Well, I checked that a small script including the above code and extern "int rb_w32_map_errno(int)" worked fine but I have not tested it inside of serverengine. I'm not a user of serverengine.

@ashie ashie self-assigned this Jan 13, 2022
@ashie
Copy link
Collaborator

ashie commented Jan 13, 2022

Thanks for your report! I'll check it.

@ashie ashie added the bug label Jan 13, 2022
ashie added a commit that referenced this issue Jan 13, 2022
Use RbConfig::CONFIG['LIBRUBY_SO'] to find dll's path.
Fix #114

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
ashie added a commit that referenced this issue Jan 13, 2022
Use RbConfig::CONFIG['LIBRUBY_SO'] to find dll's path.
Fix #114

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
ashie added a commit that referenced this issue Jan 13, 2022
Use RbConfig::CONFIG['LIBRUBY_SO'] to find dll's path.
Fix #114

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
ashie added a commit to fluent/fluentd that referenced this issue Jan 14, 2022
v2.2.4 or former doesn't work on RubyInstaller 3.1:
treasure-data/serverengine#114

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants