Skip to content

Build against SDKs older than macOS 26 - #59

Open
abhas9 wants to merge 1 commit into
antirez:mainfrom
abhas9:build-on-pre-macos26-sdks
Open

Build against SDKs older than macOS 26#59
abhas9 wants to merge 1 commit into
antirez:mainfrom
abhas9:build-on-pre-macos26-sdks

Conversation

@abhas9

@abhas9 abhas9 commented Sep 7, 2026

Copy link
Copy Markdown

make fails with the macOS 15.2 SDK because of a missing standard header and an unguarded reference to a macOS 26 SDK enum. Three added lines, no behaviour change when building against the macOS 26 SDK.

The failures

1. SSIZE_MAX undeclared - h3_ffmpeg.c

h3_ffmpeg.c:60:49: error: use of undeclared identifier 'SSIZE_MAX'
h3_ffmpeg.c:591:46: error: use of undeclared identifier 'SSIZE_MAX'

The file uses SSIZE_MAX without including <limits.h>, its POSIX defining header. Compilation relies on transitive includes, which do not supply it in the tested macOS 15.2 toolchain. SSIZE_MAX itself is not a macOS 26 addition.

2. MTLGPUFamilyMetal4 undeclared - h3_metal.m

h3_metal.m:43:51: error: use of undeclared identifier 'MTLGPUFamilyMetal4';
                        did you mean 'MTLGPUFamilyMetal3'?

MTLGPUFamilyMetal4 first appears in the macOS 26 SDK. The existing if (@available(macOS 26.0, *)) guard is a runtime check, so it cannot hide a symbol the headers never declare.

The fix

h3_ffmpeg.c includes <limits.h>.

h3_metal.m gates the probe on the SDK version in addition to the runtime check:

#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000
        if (@available(macOS 26.0, *)) {
            info->metal4 = [device supportsFamily:MTLGPUFamilyMetal4] ? 1 : 0;
        }
#endif

No #else is needed: h3_metal_probe already does memset(info, 0, sizeof(*info)), so info->metal4 stays 0 when the block is compiled out.

This is a conservative fallback: binaries built with an older SDK report Metal 4 no even when subsequently run on macOS 26 with capable hardware. Builds using SDK 26 retain the existing runtime capability check.

Verification

Verified at commit 91452961c0af4f1f3efa920e3d831014aca80fa9.

macOS 15.2 / Command Line Tools SDK 15.2

make clean && make -j8
make test

Clean build with no errors or new warnings; make test exits 0. Native AudioVAE Metal primitives and the FFmpeg video/PCM pipe test pass. Fixture-dependent checks skip because the required fixtures are not installed.

Device inspection reports Metal 4 no, as expected for this OS/SDK combination, not as a limitation of M4 hardware.

End-to-end FL2VA generation with first-frame conditioning and --ssd-streaming succeeds at 576x1024.

macOS 26.6.2 / Command Line Tools SDK 26.5

On Metal 4-capable Apple Silicon:

make -j8 all h3_tests h3_audio_gpu_tests h3_av_mux_test

The CLI, library, and selected test binaries build without warnings. The host suite passes 1,768 checks; native AudioVAE Metal primitives and FFmpeg A/V integration also pass.

A standalone assertion harness linked to the build's actual h3_metal.o confirms the positive branch against Apple's direct capability query:

native_supports_Metal4=1 h3_metal_probe_metal4=1 expected=1
PASS

The preprocessed h3_metal_probe function is identical to the base revision with SDK 26.5.

SDK and deployment-target coverage

Configuration Result
Both changed files compiled against installed SDK 15.4 Pass with -Werror
SDK 15.4 probe run on macOS 26 Returns metal4 = 0, confirming the compiled-out fallback
SDK 26.5 probe compiled with -mmacosx-version-min=15.0 Pass with -Werror -Wunguarded-availability; returns metal4 = 1 when run on macOS 26

The original Metal enum compilation failure reproduces with SDK 15.4. The original SSIZE_MAX failure does not reproduce with SDK 15.4; it was observed with SDK 15.2.

The SDK 26 build has not been run on macOS 15. Fixture-dependent tests and end-to-end generation were not repeated on macOS 26.

Note

The change was done by claude but has been manually reviewed by me. Happy to discuss this with fellow humans if needed (without any AI use in discussion)

Two symbols used unconditionally are unavailable on SDKs earlier than
macOS 26, so the build fails on a current macOS 15 toolchain.

h3_ffmpeg.c uses SSIZE_MAX without including <limits.h>. It resolves only
incidentally on newer SDKs; under -std=c11 on the macOS 15 SDK it is
undeclared. Include the header that defines it.

h3_metal.m reads MTLGPUFamilyMetal4, which the macOS 15 SDK does not
declare. The existing `if (@available(macOS 26.0, *))` guard is a runtime
check and cannot hide a symbol the headers never define, so compilation
fails before the guard can help. Gate the block on the SDK version as
well. h3_metal_probe already memsets the whole struct, so info->metal4
stays 0 when the block is compiled out, matching what the runtime guard
produces on a pre-Metal 4 device.

Behaviour is unchanged when building against the macOS 26 SDK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NixTm9kQ7hojQo8nWUQGpS
@abhas9
abhas9 marked this pull request as ready for review September 7, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant