Skip to content

Linux loader-assist: install the .so without sudo (spike)#46

Merged
SethMorrowSoftware merged 1 commit into
mainfrom
claude/beautiful-cray-lwlsgr
Jun 15, 2026
Merged

Linux loader-assist: install the .so without sudo (spike)#46
SethMorrowSoftware merged 1 commit into
mainfrom
claude/beautiful-cray-lwlsgr

Conversation

@SethMorrowSoftware

Copy link
Copy Markdown
Owner

Goal

Let Linux users run Box2Dxt without sudo — and ideally without any per-user setup at all — by making "drop box2dxt.so next 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.so to dlopen and never searches the stack's folder, so today the library must sit on a system search path — typically sudo 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 exactly box2dxt.so.

  • 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 -DBOX2DXT_BARE_SONAME=ON builds the library under its bare deploy name so its soname is box2dxt.so. Default OFF keeps the historical libbox2dxt.* artifact, so nothing in the existing build/CI/docs changes yet.

Verified locally (build half)

Build Artifact soname
default (flag off) libbox2dxt.so libbox2dxt.so
-DBOX2DXT_BARE_SONAME=ON box2dxt.so box2dxt.so

The default-build control proves why a plain file rename can't work: renamed to box2dxt.so, the soname is still libbox2dxt.so.

Needs an OXT pass (the spike question)

Two things can only be confirmed in OXT:

  1. Does c:>dlopen bind? (Fallback tokens for libc/libdl are noted in the .lcb.)
  2. Does the engine honor the preloaded copy — i.e. after b2LoadNativeLib("/abs/path/box2dxt.so") returns 1, does b2Version() return 4 with the .so on no search path?

If yes, the follow-up is to wire the Kit to call b2LoadNativeLib automatically (Linux-gated) at startup, flip the soname default on, and update docs/CI. If no, fall back to the per-user ~/.local/lib self-installer.

https://claude.ai/code/session_01EVV5fGeXqtWs8WDrmgWNku


Generated by Claude Code

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
@SethMorrowSoftware SethMorrowSoftware marked this pull request as ready for review June 15, 2026 19:01
@SethMorrowSoftware SethMorrowSoftware merged commit f6deeef into main Jun 15, 2026
7 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