Skip to content

Hide Go runtime symbols to allow coexistence with other Charm gems#1

Merged
marcoroth merged 1 commit intomarcoroth:mainfrom
khasinski:fix/hide-go-runtime-symbols
Feb 17, 2026
Merged

Hide Go runtime symbols to allow coexistence with other Charm gems#1
marcoroth merged 1 commit intomarcoroth:mainfrom
khasinski:fix/hide-go-runtime-symbols

Conversation

@khasinski
Copy link
Contributor

@khasinski khasinski commented Feb 17, 2026

Summary

When multiple Charm gems (bubblezone, lipgloss, bubbletea, etc.) are loaded together in the same Ruby process, calling Go-backed functions causes a segfault due to Go runtime symbol clashes. Each gem embeds a full Go runtime via c-archive, and the duplicate symbols collide when both runtimes are active.

This is especially problematic with cross-compiled gems (via rake-compiler-dock), where Ruby's rbconfig adds -Wl,-flat_namespace - putting all symbols into a single global pool.

Fix

  • macOS: Use -load_hidden to link the Go static archive with all symbols hidden, and -exported_symbol to export only _Init_bubblezone.
  • Linux: Use --exclude-libs,ALL to hide all symbols from the Go static archive.

Same fix as marcoroth/lipgloss-ruby#5 and marcoroth/bubbletea-ruby#4.

Copy link
Owner

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @khasinski! 🙏🏼

@marcoroth marcoroth merged commit e471301 into marcoroth:main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants