Project

General

Profile

Actions

Bug #21920

closed

LIBRUBYARG_SHARED contains -lgmp and other libraries for static linking

Bug #21920: LIBRUBYARG_SHARED contains -lgmp and other libraries for static linking

Added by larskanis (Lars Kanis) 1 day ago. Updated 1 day ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-02-21 master e730ac41be) +PRISM [aarch64-mingw-ucrt]
[ruby-core:124855]

Description

That recent commit introduced MAINLIBS into LIBRUBYARG_SHARED: https://github.com/ruby/ruby/commit/d256629bf9e194838d1837be74dcc0b8ff0bcfd6

Before that commit:

  CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
  CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static $(MAINLIBS)"

  RbConfig::CONFIG["LIBRUBYARG_SHARED"] # => "-laarch64-ucrt-ruby410"

After that commit:

  CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME) $(MAINLIBS)"
  CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static $(MAINLIBS)"

  RbConfig::CONFIG["LIBRUBYARG_SHARED"] # => "-laarch64-ucrt-ruby410 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -lbcrypt"

To my understanding MAINLIBS are only for static linking and these libraries are not necessary for shared linking.

This breaks RubyInstaller for Windows, since all C extensions are linked with LIBRUBYARG_SHARED and the RubyInstaller distribution ships libgmp-10.dll only but not related the libgmp.a file. The same happens on x86_64. It is probably an issue on other operating systems as well.

A CI failure log is here: https://github.com/oneclick/rubyinstaller2/actions/runs/22238372563/job/64335608163#step:36:32

Updated by byroot (Jean Boussier) 1 day ago 1Actions #1 [ruby-core:124859]

  • Status changed from Open to Closed
  • Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONTNEED

The commit was reverted https://github.com/ruby/ruby/pull/16212, it should be fixed now.

Actions

Also available in: PDF Atom