Linux loader-assist: install the .so without sudo (spike)#46
Merged
Conversation
On Linux the OXT engine hands the bare name box2dxt.so to dlopen and never searches the stack's folder, so the library has to sit on a system search path (typically sudo cp to /usr/lib + ldconfig). This adds a no-sudo alternative: preload the shim by absolute path so the engine's later bare-name bind resolves to the already-resident copy. - src/box2dxt.lcb: bind the platform dlopen/dlerror (resolved from the host process, so callable before box2dxt.so is loadable) and expose b2LoadNativeLib(path) / b2LoadNativeLibError(). No new C ABI symbol, so b2Version() stays 4. - CMakeLists.txt: opt-in BOX2DXT_BARE_SONAME builds the library under its bare deploy name so its soname is box2dxt.so -- glibc matches an already-loaded object by soname, not filename, so a renamed libbox2dxt.so (soname still libbox2dxt.so) would not match. Default OFF keeps the historical artifact. Verified locally: flag ON yields box2dxt.so with soname box2dxt.so; default yields libbox2dxt.so with soname libbox2dxt.so. The remaining unknown -- does the engine honor the preloaded copy, and does c:>dlopen bind -- needs an OXT pass. https://claude.ai/code/session_01EVV5fGeXqtWs8WDrmgWNku
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Let Linux users run Box2Dxt without sudo — and ideally without any per-user setup at all — by making "drop
box2dxt.sonext to the stack" work on Linux the way it already does on Windows/macOS.The problem
On Linux the OXT/LiveCode engine hands the bare name
box2dxt.sotodlopenand never searches the stack's folder, so today the library must sit on a system search path — typicallysudo cp box2dxt.so /usr/lib/ && sudo ldconfig.The approach (this spike)
Preload the shim by absolute path before the first physics call. Once it's in the process, the engine's later bare-name
dlopen("box2dxt.so")resolves to the already-resident copy. glibc matches an already-loaded object by soname, not filename, so this only works if the soname is exactlybox2dxt.so.src/box2dxt.lcb— bind the platformdlopen/dlerror(resolved from the host process, so callable beforebox2dxt.sois loadable) and exposeb2LoadNativeLib(path)/b2LoadNativeLibError(). No new C ABI symbol, sob2Version()stays4.CMakeLists.txt— opt-in-DBOX2DXT_BARE_SONAME=ONbuilds the library under its bare deploy name so its soname isbox2dxt.so. Default OFF keeps the historicallibbox2dxt.*artifact, so nothing in the existing build/CI/docs changes yet.Verified locally (build half)
libbox2dxt.solibbox2dxt.so-DBOX2DXT_BARE_SONAME=ONbox2dxt.sobox2dxt.soThe default-build control proves why a plain file rename can't work: renamed to
box2dxt.so, the soname is stilllibbox2dxt.so.Needs an OXT pass (the spike question)
Two things can only be confirmed in OXT:
c:>dlopenbind? (Fallback tokens for libc/libdl are noted in the.lcb.)b2LoadNativeLib("/abs/path/box2dxt.so")returns1, doesb2Version()return4with the.soon no search path?If yes, the follow-up is to wire the Kit to call
b2LoadNativeLibautomatically (Linux-gated) at startup, flip the soname default on, and update docs/CI. If no, fall back to the per-user~/.local/libself-installer.https://claude.ai/code/session_01EVV5fGeXqtWs8WDrmgWNku
Generated by Claude Code