Skip to content

Stage libDeviceContextGlobals alongside the mojo runtime libs#97

Closed
joshpeterson wants to merge 1 commit into
modular:mainfrom
joshpeterson:josh/stage-device-context-globals
Closed

Stage libDeviceContextGlobals alongside the mojo runtime libs#97
joshpeterson wants to merge 1 commit into
modular:mainfrom
joshpeterson:josh/stage-device-context-globals

Conversation

@joshpeterson

Copy link
Copy Markdown

libAsyncRTMojoBindings now carries a runtime NEEDED on libDeviceContextGlobals (the virtual-device state was split into its own shared library so a process holds exactly one copy per process). The mojo toolchain stages a fixed set of support libraries next to every compiled mojo binary, and libDeviceContextGlobals was missing from it, so mojo binaries fail to load with libDeviceContextGlobals.so: cannot open shared object file once the runtime depends on it.

Add it to the glob. allow_empty=False still holds over the whole list, so older mojo packages that don't ship the library keep resolving (the pattern just matches nothing).

Needed to reland modularml/modular#88716.

libAsyncRTMojoBindings now carries a runtime NEEDED on
libDeviceContextGlobals (the virtual-device state was split into its own
shared library so a process holds exactly one copy of it). The mojo
toolchain stages a fixed set of support libraries next to every compiled
mojo binary; libDeviceContextGlobals was missing from that set, so mojo
binaries failed to load with "libDeviceContextGlobals.so: cannot open
shared object file" once the runtime started depending on it.

Add it to the glob. The glob keeps allow_empty=False over the whole
list, so older mojo packages that don't ship the library still resolve
(the pattern simply matches nothing) and nothing depends on it there.
@joshpeterson

Copy link
Copy Markdown
Author

Closing — we're taking a simpler single-repo approach in modularml/modular#90359 that hosts the virtual-device state in the existing AsyncRTRuntimeGlobals shared library instead of introducing a new one, so the mojo toolchain doesn't need to learn about a new staged support library. No rules_mojo change needed.

@joshpeterson joshpeterson deleted the josh/stage-device-context-globals branch June 30, 2026 12:50
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.

1 participant