The Mac app of Yonto Player has two players: Apple's AVPlayer, and VLCKit, VLC's framework, for everything AVPlayer can't read (two video players in one app, and the rule that picks one).
A crash report came in from a Mac on macOS 15.7: the app closed the moment VLCKit started a video from a media server.
On macOS 27, the same build played the same kind of file fine.
The cause turned out to be one line of VLC's C, a configure check, and the SDK we build with.
This is how the crash report pointed at it, and the build check that now stops the whole class.
What the report said
The exception was the usual one, and the registers said more than the backtrace:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 pc: 0x0000000000000000 lr: 0x...48c8 x16: 0x0000000000000000 esr: 0x82000006 (Instruction Abort) Translation fault pc is 0 and the fault is an instruction abort.
So nothing read through a NULL pointer: the CPU was told to run code at address 0.
The backtrace was torn, a VLC thread with one frame in vlc_tls_Connect, the TCP connect, and then nothing.
The link register is the better witness.
Symbolicated against VLCKit's dSYM, lr landed in vlc_pipe, and the disassembly shows what came just before it:
_vlc_pipe: stp x29, x30, [sp, #-0x10]! mov w1, #0x1000000 ; O_CLOEXEC bl pipe2 ; symbol stub ldp x29, x30, [sp], #0x10 ; <- lr points here ret A call to an imported function on arm64 goes through a stub that loads the function's address into x16 and branches to it.
x16 was 0 too.
So pipe2 had resolved to NULL, and calling it jumped to 0.
Why pipe2 was NULL
pipe2 makes a pipe and sets flags on it in one call.
Linux has had it for years; the macOS 27 SDK declares it, as available from macOS 27:
__API_AVAILABLE(macos(27.0), ios(27.0), tvos(27.0), watchos(27.0), visionos(27.0)) int pipe2(int [2], int); When code built for an older deployment target calls a function marked newer than that target, the toolchain makes it a weak import.
On a system that has the function, it resolves as usual.
On one that doesn't, the loader doesn't refuse to start the app: it leaves the address 0, and it's up to the code to check before calling.
That's the right behaviour for code written to check, and a trap for code that isn't.
VLC's code isn't, because it never expected to need to:
int vlc_pipe (int fds[2]) { #ifdef HAVE_PIPE2 return pipe2(fds, O_CLOEXEC); #else int ret = pipe(fds); /* ...then set close-on-exec on both ends */ #endif } HAVE_PIPE2 comes from VLC's autoconf configure, which decides it with a link test: does a tiny program calling pipe2 link against this SDK?
With the macOS 27 SDK it does, so configure says yes, VLC compiles the pipe2 branch, and the framework works on 27 and calls a NULL address on any system older than the SDK.
Why it hit network video
vlc_pipe isn't only called when VLC wants a pipe for itself.
VLC's interruptible waits, the ones a stop or a seek can cut short, create a pipe for each wait, so another thread can wake the waiting one.
A TCP connect waits in one of those.
So the first TCP connect of a stream made a pipe while it waited, called pipe2, and jumped to 0.
The fix: answer configure's question ourselves
Autoconf caches each answer in a shell variable, ac_cv_func_<name>, and takes it from the environment when it's already set.
Setting it to no makes VLC take the pipe plus close-on-exec branch, which every macOS has:
# configure's link test finds pipe2 in the SDK, which declares it for macOS, # iOS and tvOS 27, so vlc_pipe would call a weak import that is NULL on an # older system. export ac_cv_func_pipe2=no That one line went into our VLCKit build script, and the rebuilt VLCKit, 3.7.3-7, has no pipe2 import in any slice, the Mac's, the iPhone's or the Apple TV's.
The framework is our own LGPL build of VLCKit, published with its recipe in yonto-app/libvlc-lgpl.
The guard: no weak import from libSystem
Fixing pipe2 fixes this one.
The next SDK will declare another new function, and configure will find that too.
So the build script now fails on any weak import from libSystem, the C library, in every architecture of the device frameworks it ships.
A simplified version:
for arch in $(lipo -archs "$framework"); do weak=$(nm -m -arch "$arch" "$framework" \ | sed -n 's/.*(undefined) weak external \(_[^ ]*\) (from libSystem)$/\1/p' \ | grep -v -x _getentropy || true) if [ -n "$weak" ]; then echo "$framework ($arch) weak-links $weak, which is NULL on a system older than the SDK" >&2 exit 1 fi done nm -m prints each undefined symbol with where it comes from and whether it's weak.
The one allowed is getentropy, which the Mac has had since 10.12, older than our target.
Anything else stops the build, with the function's name, before a framework ever reaches an app.
What to take from it
- On arm64,
pc0 withx160 is a missing weak import. Look atlr: the instruction before it is the call, and it names the function. - A newer SDK plus a link-test configure finds functions your oldest system doesn't have. Autoconf checks "does it link", not "does it exist on the oldest OS I support". Pin the answer with
ac_cv_func_<name>=nowhen it's wrong. - Weak imports are a list you can check.
nm -mgives it to you, so a build can refuse a new one rather than a user finding it. - A crash report's registers are worth reading before its backtrace. The backtrace here was torn;
pc,lr,x16and the exception syndrome told the whole story.
The fix is in Yonto Player 5.6.5 for the Mac, which installs over the earlier version (Install on the Mac).
The iPhone, iPad and Apple TV apps are coming soon.
Read more: versioning a fast-moving app, Telling a media server what this device can decode, and the release notes.
