MOB-89: cpp_archive NDK resolution honors ANDROID_HOME#40
Merged
Conversation
MobDev.Plugin.CppArchive and MobDev.NxEigenNif hardcoded
~/Library/Android/sdk/ndk/<ver> (+ darwin-x86_64), ignoring ANDROID_HOME /
ANDROID_SDK_ROOT — so a lang: :cpp_archive plugin build failed with
'NDK toolchain not found' wherever the NDK lived elsewhere, unlike the main
NativeBuild path which honored ANDROID_HOME. Found building mob_nx_eigen.
Add shared MobDev.NdkVersion.{root,host,toolchain_bin,sysroot}/0 (built on the
existing sdk_root/0, which already reads ANDROID_HOME/ANDROID_SDK_ROOT) and route
all three call sites through them — cpp_archive, nx_eigen_nif, and native_build's
ndk_sysroot — so the NDK path is single-sourced and can't diverge again.
Tests pin root/0 honoring ANDROID_HOME (not a hardcoded ~/Library path),
ANDROID_SDK_ROOT fallback, host tag, and sysroot/toolchain composition.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
MobDev.Plugin.CppArchive(andMobDev.NxEigenNif, which it was copied from) resolved the Android NDK with a hardcoded~/Library/Android/sdk/ndk/<ver>+darwin-x86_64host, ignoringANDROID_HOME/ANDROID_SDK_ROOT— unlike the mainMobDev.NativeBuild.ndk_sysroot/0, which honors them. So alang: :cpp_archiveplugin build (e.g.mob_nx_eigen) failed withNDK toolchain not found at ~/Library/Android/sdk/ndk/<ver>on any machine whose NDK lives elsewhere (CI, a shared SDK), even withANDROID_HOMEset. Surfaced during the MOB-42 nx_eigen build verification.Fix
MobDev.NdkVersion.sdk_root/0already readsANDROID_HOME→ANDROID_SDK_ROOT→ OS default. Addedroot/0,host/0,toolchain_bin/0,sysroot/0on top of it and routed all three call sites through them:cpp_archive.ex—default_ndk_root/android_toolchain_binnx_eigen_nif.ex— the identical hardcoded copynative_build.ex—ndk_sysroot/0now delegates (provably equivalent, and now also honorsANDROID_SDK_ROOT+ Linux host)One source of truth, so the NDK path can't diverge again.
Tests
ndk_version_test.exspinsroot/0honoringANDROID_HOME(not a hardcoded~/Librarypath), theANDROID_SDK_ROOTfallback, the host tag, and sysroot/toolchain composition. cpp_archive + native_build suites stay green;mix credo --strictclean.Part of making
mob_nx_eigenbuild out-of-the-box (MOB-42); pairs with MOB-90 (Eigen provisioning).🤖 Generated with Claude Code