ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:124854] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc`
@ 2026-02-20 19:10 reitermarkus (Markus Reiter) via ruby-core
  2026-02-22  2:27 ` [ruby-core:124865] " nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-22  4:15 ` [ruby-core:124866] " reitermarkus (Markus Reiter) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: reitermarkus (Markus Reiter) via ruby-core @ 2026-02-20 19:10 UTC (permalink / raw)
  To: ruby-core; +Cc: reitermarkus (Markus Reiter)

Issue #21919 has been reported by reitermarkus (Markus Reiter).

----------------------------------------
Bug #21919: `libruby-static.a` links to wrong `Init_enc`
https://bugs.ruby-lang.org/issues/21919

* Author: reitermarkus (Markus Reiter)
* Status: Open
* 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/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



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:124865] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc`
  2026-02-20 19:10 [ruby-core:124854] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc` reitermarkus (Markus Reiter) via ruby-core
@ 2026-02-22  2:27 ` nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-22  4:15 ` [ruby-core:124866] " reitermarkus (Markus Reiter) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2026-02-22  2:27 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21919 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

`--with-static-linked-ext` means the extension libraries including encodings are linked to the ruby executable or library.so.
`-static.a` is not intended to link these extensions.

----------------------------------------
Bug #21919: `libruby-static.a` links to wrong `Init_enc`
https://bugs.ruby-lang.org/issues/21919#change-116518

* 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/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



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:124866] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc`
  2026-02-20 19:10 [ruby-core:124854] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc` reitermarkus (Markus Reiter) via ruby-core
  2026-02-22  2:27 ` [ruby-core:124865] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-02-22  4:15 ` reitermarkus (Markus Reiter) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: reitermarkus (Markus Reiter) via ruby-core @ 2026-02-22  4:15 UTC (permalink / raw)
  To: ruby-core; +Cc: reitermarkus (Markus Reiter)

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/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



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-22  4:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 19:10 [ruby-core:124854] [Ruby Bug#21919] `libruby-static.a` links to wrong `Init_enc` reitermarkus (Markus Reiter) via ruby-core
2026-02-22  2:27 ` [ruby-core:124865] " nobu (Nobuyoshi Nakada) via ruby-core
2026-02-22  4:15 ` [ruby-core:124866] " reitermarkus (Markus Reiter) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).