Project

General

Profile

Actions

Bug #21919

closed

`libruby-static.a` links to wrong `Init_enc`

Bug #21919: `libruby-static.a` links to wrong `Init_enc`

Added by reitermarkus (Markus Reiter) 2 days ago. Updated about 12 hours ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [arm64-darwin20]
[ruby-core:124854]

Description

When building Ruby with --with-static-linked-ext, libruby-static.a links the Init_enc function from dmyenc.c instead of enc/encinit.c.erb, resulting in uninitialized constant Encoding::UTF_8 error, among other things.

There seems to be a discrepancy between INITOBJS (https://github.com/ruby/ruby/blob/e730ac41be4d427f06540e0f67fa16bbdced4789/common.mk#L81) and ENCOBJS/EXTOBJS (https://github.com/ruby/ruby/blob/e730ac41be4d427f06540e0f67fa16bbdced4789/configure.ac#L3139-L3152).

Currently, the only workaround I found is to manually link enc/libenc.a and enc/libtrans.a to the final binary.

Originally reported here: https://github.com/matsadler/magnus/issues/169

Actions

Also available in: PDF Atom