Bug #21920
closedLIBRUBYARG_SHARED contains -lgmp and other libraries for static linking
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
- 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.