Skip to content

cmdliner-android: install the tool into the sysroot, not /usr/bin - #49

Merged
toots merged 1 commit into
ocaml-cross:mainfrom
toots:cmdliner-bindir
Aug 15, 2026
Merged

toots merged 1 commit into
ocaml-cross:mainfrom
toots:cmdliner-bindir

Conversation

@toots

@toots toots commented Aug 15, 2026

Copy link
Copy Markdown
Member

The install stanza overrides LIBDIR and leaves BINDIR at the Makefile's default:

PREFIX=/usr
BINDIR=$(DESTDIR)$(PREFIX)/bin
prepare-prefix:
	$(INSTALL) -d "$(BINDIR)" "$(LIBDIR)"
install-bin:
	$(INSTALL) -m 755 "$(TOOLBDIR)/cmdliner" "$(BINDIR)/cmdliner"

So prepare-prefix creates /usr/bin, and the package is one target away from installing an aarch64-Android cmdliner binary into the host's path. Under opam's sandbox it fails outright:

install: cannot change permissions of '/usr/bin': Read-only file system
make: *** [Makefile:96: prepare-prefix] Error 1

Pointing BINDIR at the sysroot, as LIBDIR already is, fixes both. Verified against ocaml-android.5.4.1: opam install cmdliner-android succeeds where it previously failed, and /usr/bin is untouched.

This is easy to miss because a warm switch hides it — the package installs once wherever /usr happens to be writable, and every later opam install reports it as already present. It surfaces on any cold, sandboxed install.

The install stanza overrode LIBDIR and left BINDIR at the Makefile's default
of $(PREFIX)/bin with PREFIX=/usr, so prepare-prefix creates /usr/bin and
install-bin puts an aarch64-Android cmdliner binary in the host's path.

Under opam's sandbox that fails outright -- install: cannot change
permissions of '/usr/bin': Read-only file system -- so the package only
installs where /usr happens to be writable.
toots added a commit to toots/tsync that referenced this pull request Aug 15, 2026
The cross build wants memtrace and the android repository had no port of it,
so the daemon stopped at "Library memtrace not found". ocaml-cross/opam-cross-android#48
adds one; this asks for it.

The cache key goes with it, as the comment above it asks. That is not free:
the restored switch is what has been carrying cmdliner-android, which does
not survive a cold sandboxed install (ocaml-cross/opam-cross-android#49), so
this wants that fix merged before it reaches main.
@toots
toots merged commit 91d9d80 into ocaml-cross:main Aug 15, 2026
23 checks passed
toots added a commit to toots/tsync that referenced this pull request Aug 15, 2026
The cross build wants memtrace and the android repository had no port of it,
so the daemon stopped at "Library memtrace not found". ocaml-cross/opam-cross-android#48
adds one; this asks for it.

The cache key goes with it, as the comment above it asks. That is not free:
the restored switch is what has been carrying cmdliner-android, which does
not survive a cold sandboxed install (ocaml-cross/opam-cross-android#49), so
this wants that fix merged before it reaches main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant