[ruby-core:124855] [Ruby Bug#21920] LIBRUBYARG_SHARED contains -lgmp and other libraries for static linking
Issue #21920 has been reported by larskanis (Lars Kanis). ---------------------------------------- Bug #21920: LIBRUBYARG_SHARED contains -lgmp and other libraries for static linking https://bugs.ruby-lang.org/issues/21920 * Author: larskanis (Lars Kanis) * Status: Open * ruby -v: ruby 4.1.0dev (2026-02-21 master e730ac41be) +PRISM [aarch64-mingw-ucrt] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- 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/6433... -- https://bugs.ruby-lang.org/
Issue #21920 has been updated by byroot (Jean Boussier). 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. ---------------------------------------- Bug #21920: LIBRUBYARG_SHARED contains -lgmp and other libraries for static linking https://bugs.ruby-lang.org/issues/21920#change-116513 * Author: larskanis (Lars Kanis) * Status: Closed * ruby -v: ruby 4.1.0dev (2026-02-21 master e730ac41be) +PRISM [aarch64-mingw-ucrt] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONTNEED ---------------------------------------- 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/6433... -- https://bugs.ruby-lang.org/
participants (2)
-
byroot (Jean Boussier) -
larskanis (Lars Kanis)