Commit 0c1cbd8
committed
Hide Go runtime symbols to allow coexistence with other Charm gems
When multiple Charm gems (bubbletea, lipgloss, etc.) are loaded in the
same Ruby process, each embeds its own Go runtime via c-archive static
linking. Ruby loads .bundle files with RTLD_GLOBAL, causing ~1900 Go
runtime symbols to clash in the global namespace, resulting in a segfault.
Fix this by using -load_hidden (macOS) / --version-script (Linux) to
make all Go runtime symbols local to the .bundle. Only Init_lipgloss
is exported. The Go API symbols (lipgloss_*) remain accessible within the
bundle since they're resolved at link time.
Tested: bubbletea + lipgloss loaded together in Ruby 4.0 — no segfault.1 parent 501a8af commit 0c1cbd8
2 files changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
49 | | - | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
0 commit comments