nandi/jolt-nativepublic Fork 0
2bd393e
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Let the Android glue be built without the media plane

JOLT_WITHOUT_MOQ takes libjoltmoq out of android/jolt_main.c: the header,
the thirty symbol registrations, and the JNI handover that hands the plane
the VM and activity it cannot get for itself.

The registrations are the reason this needs a flag rather than nothing at
all. They exist because Android's loader will not answer a foreign-entry
lookup that crosses a shared object, so each symbol is registered by hand —
and libjoltapp links with --no-undefined, which turns every one of them
into a link error the moment the object is not linked.

frq is the consumer that wants this: its media plane is jolt now, over
libmoq_ffi, libopus and openh264, and none of that is built for Android
yet. So a phone has no media plane at all, frq.av/available? says so, and
the APK was carrying seventeen megabytes of Rust nothing opens. libvidya
does not need libc++_shared either — its NEEDED list is libdl, libandroid,
liblog, libm and libc — so that goes with it.

Default is unchanged: build without the define and the glue is what it was.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-10T05:20:33-07:00 Browse files
2bd393e parent: 2975a43
modified android/jolt_main.c +14 -0
@@ -29,7 +29,15 @@
2929 #include <android/log.h>
3030 #include <pthread.h>
3131
32+/* JOLT_WITHOUT_MOQ builds this glue for an app that does not link
33+ * libjoltmoq. frq is one: its media plane is jolt now — MoQ through
34+ * libmoq_ffi, Opus, H.264, V4L2 and ALSA — so the Rust one is an object it
35+ * never opens, and seventeen megabytes of APK for nothing. Everything moq
36+ * below is behind this, because --no-undefined turns an unreferenced symbol
37+ * into a link error rather than a surprise on the phone. */
38+#ifndef JOLT_WITHOUT_MOQ
3239 #include "joltmoq.h"
40+#endif
3341 #include "scheme.h"
3442 #include "vidya.h"
3543 #include "vidya_tree.h"
@@ -114,6 +122,7 @@ static void register_vidya_api(void) {
114122 REGISTER_VIDYA(vidya_tree_dump);
115123 }
116124
125+#ifndef JOLT_WITHOUT_MOQ
117126 /*
118127 * The media plane's symbols, registered for the same reason the Vidya ones
119128 * above are: they live in libjoltmoq.so, a third object, and Android's loader
@@ -164,6 +173,7 @@ static void register_joltmoq_api(void) {
164173 REGISTER_JOLTMOQ(joltmoq_can_dial);
165174 REGISTER_JOLTMOQ(joltmoq_new_instance);
166175 }
176+#endif /* JOLT_WITHOUT_MOQ */
167177
168178 /*
169179 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into
@@ -204,8 +214,11 @@ int vidya_jolt_main(void) {
204214 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));
205215 Sbuild_heap(NULL, NULL);
206216 register_vidya_api();
217+#ifndef JOLT_WITHOUT_MOQ
207218 register_joltmoq_api();
219+#endif
208220
221+#ifndef JOLT_WITHOUT_MOQ
209222 /* The media plane's own handles, which it cannot get for itself: they arrive
210223 in android-activity's glue, and the glue is in libvidya.so. This is the
211224 only place both objects are in scope. Before Scheme starts, so no call can
@@ -221,6 +234,7 @@ int vidya_jolt_main(void) {
221234 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",
222235 moq_vm, moq_activity);
223236 joltmoq_android_init(moq_vm, moq_activity);
237+#endif
224238
225239 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");
226240 int status = Sscheme_start(1, argv);
@@ -29,7 +29,15 @@
29 #include <android/log.h>29 #include <android/log.h>
30 #include <pthread.h>30 #include <pthread.h>
31 31
32+/* JOLT_WITHOUT_MOQ builds this glue for an app that does not link
33+ * libjoltmoq. frq is one: its media plane is jolt now — MoQ through
34+ * libmoq_ffi, Opus, H.264, V4L2 and ALSA — so the Rust one is an object it
35+ * never opens, and seventeen megabytes of APK for nothing. Everything moq
36+ * below is behind this, because --no-undefined turns an unreferenced symbol
37+ * into a link error rather than a surprise on the phone. */
38+#ifndef JOLT_WITHOUT_MOQ
32 #include "joltmoq.h"39 #include "joltmoq.h"
40+#endif
33 #include "scheme.h"41 #include "scheme.h"
34 #include "vidya.h"42 #include "vidya.h"
35 #include "vidya_tree.h"43 #include "vidya_tree.h"
@@ -114,6 +122,7 @@ static void register_vidya_api(void) {
114 REGISTER_VIDYA(vidya_tree_dump);122 REGISTER_VIDYA(vidya_tree_dump);
115 }123 }
116 124
125+#ifndef JOLT_WITHOUT_MOQ
117 /*126 /*
118 * The media plane's symbols, registered for the same reason the Vidya ones127 * The media plane's symbols, registered for the same reason the Vidya ones
119 * above are: they live in libjoltmoq.so, a third object, and Android's loader128 * above are: they live in libjoltmoq.so, a third object, and Android's loader
@@ -164,6 +173,7 @@ static void register_joltmoq_api(void) {
164 REGISTER_JOLTMOQ(joltmoq_can_dial);173 REGISTER_JOLTMOQ(joltmoq_can_dial);
165 REGISTER_JOLTMOQ(joltmoq_new_instance);174 REGISTER_JOLTMOQ(joltmoq_new_instance);
166 }175 }
176+#endif /* JOLT_WITHOUT_MOQ */
167 177
168 /*178 /*
169 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into179 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into
@@ -204,8 +214,11 @@ int vidya_jolt_main(void) {
204 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));214 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));
205 Sbuild_heap(NULL, NULL);215 Sbuild_heap(NULL, NULL);
206 register_vidya_api();216 register_vidya_api();
217+#ifndef JOLT_WITHOUT_MOQ
207 register_joltmoq_api();218 register_joltmoq_api();
219+#endif
208 220
221+#ifndef JOLT_WITHOUT_MOQ
209 /* The media plane's own handles, which it cannot get for itself: they arrive222 /* The media plane's own handles, which it cannot get for itself: they arrive
210 in android-activity's glue, and the glue is in libvidya.so. This is the223 in android-activity's glue, and the glue is in libvidya.so. This is the
211 only place both objects are in scope. Before Scheme starts, so no call can224 only place both objects are in scope. Before Scheme starts, so no call can
@@ -221,6 +234,7 @@ int vidya_jolt_main(void) {
221 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",234 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",
222 moq_vm, moq_activity);235 moq_vm, moq_activity);
223 joltmoq_android_init(moq_vm, moq_activity);236 joltmoq_android_init(moq_vm, moq_activity);
237+#endif
224 238
225 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");239 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");
226 int status = Sscheme_start(1, argv);240 int status = Sscheme_start(1, argv);