Repository navigation
Generate the app driver table when an opt-in built-in NIF is enabled (MOB-394) - #141
Conversation
…(MOB-394) A blank app with nx_tflite_mob in deps had no priv/generated/driver_tab_*, so it linked against mob's core table, which carries no TFLite entry: the template linked libtflite_nif.a, but NxTfliteMob.NIF never registered and loaded as `dlopen failed: library "libtflite_nif.so" not found`. regen_driver_tab! created an app table only when a plugin contributed NIFs. It now also creates one when any guarded built-in of StaticNifs.default_nifs/0 is enabled, judged by the same dep checks the native build uses to compile and link it (tflite_in_project?, nxeigen_in_project?, emlx_in_project?). NxEigen is covered by the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-394 review) mob's core iOS table already registers emlx_nif and EMLX is iOS-only, so a generated table added nothing and would make app build files from mob_new <=0.3.15 (no tflite_static option) fail to compile it. The NxEigen rule is now exercised by a host with an nx_eigen dep instead of an injected predicate; scratch hosts are removed on test exit even when an assertion fails.
|
Review: Codex hit its usage limit (until 5:26 PM), so a reviewer subagent reviewed instead. Round 1: MERGE with two findings (drop EMLX from the trigger: core iOS table already registers it and old app build files lack tflite_static; test the real guard→dep mapping end to end). Both fixed in b10415c; re-review: MERGE, no findings. Fail-before/pass-after: with the trigger reverted to plugins-only, the TFLite and NxEigen host tests fail (no table written); with the fix, 236/236 in native_build_test.exs. Device proof (blank host from mob_new#103 + this branch as a path dep, nx_tflite_mob 0.0.4): |
Part of MOB-394 (with GenericJam/mob_new#103).
A blank app with
nx_tflite_mobin deps had nopriv/generated/driver_tab_*, so it linked mob's core table, which has no TFLite entry. With the mob_new template linkinglibtflite_nif.a, the app launched butNxTfliteMob.NIFfailed to load (dlopen failed: library "libtflite_nif.so" not found): the static NIF was linked but never registered.regen_driver_tab!/0created an app table only when a plugin contributed NIFs. It now also does when any guarded built-in ofMobDev.StaticNifs.default_nifs/0is enabled, using the same dep checks the native build uses to compile/link it (tflite_in_project?,nxeigen_in_project?,emlx_in_project?). NxEigen is covered by the same rule; no separate fix needed.Tests: a host Mix project with an
nx_tflite_mobpath dep gets tables containingtflite_nif_nif_init(fails on master: no table created); a host with no opt-in NIF gets none; the guard→module mapping.Device proof: see MOB-394 (Android emulator + iOS sim, NxTfliteMob.load_module + call).