Issue #21919 has been updated by reitermarkus (Markus Reiter). nobu (Nobuyoshi Nakada) wrote in #note-1:
`--with-static-linked-ext` means the extension libraries including encodings are linked to the ruby executable or library.so.
Which `library.so` is that exactly? nobu (Nobuyoshi Nakada) wrote in #note-1:
`-static.a` is not intended to link these extensions.
Can you please clarify *why* it is not intended? I'd like to include a fully static Ruby interpreter in a Rust executable. Also needing to ship `encdb.so` and `transdb.so` kinda defeats the purpose of a having a static binary. What would be the proper solution here? ---------------------------------------- Bug #21919: `libruby-static.a` links to wrong `Init_enc` https://bugs.ruby-lang.org/issues/21919#change-116519 * Author: reitermarkus (Markus Reiter) * Status: Rejected * ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [arm64-darwin20] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- 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/c...) and `ENCOBJS`/`EXTOBJS` (https://github.com/ruby/ruby/blob/e730ac41be4d427f06540e0f67fa16bbdced4789/c...). 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 -- https://bugs.ruby-lang.org/