Skip to content

fix(ios): define BLAKE3_NO_* macros for x86_64 simulator#917

Merged
boorad merged 1 commit intomargelo:mainfrom
stefan-garofalo:fix/ios-blake3-x86_64-simd-symbols
Feb 12, 2026
Merged

fix(ios): define BLAKE3_NO_* macros for x86_64 simulator#917
boorad merged 1 commit intomargelo:mainfrom
stefan-garofalo:fix/ios-blake3-x86_64-simd-symbols

Conversation

@stefan-garofalo
Copy link
Contributor

@stefan-garofalo stefan-garofalo commented Feb 12, 2026

Summary

Companion to #884. That PR excluded blake3_neon.c for x86_64 simulator (compile-time fix), but x86 SIMD symbols (AVX-512, AVX2, SSE4.1, SSE2) still cause linker errors:

Undefined symbols for architecture x86_64:
  _blake3_compress_in_place_avx512
  _blake3_compress_in_place_sse2
  _blake3_compress_in_place_sse41
  _blake3_compress_xof_avx512
  ...

The .c implementation files (blake3_avx512.c, etc.) are correctly excluded via exclude_files, but blake3_dispatch.c still references those symbols — it forward-declares and calls them unless BLAKE3_NO_* macros are defined:

#if !defined(BLAKE3_NO_AVX512)
  if (features & AVX512VL) {
    blake3_compress_in_place_avx512(cv, block, block_len, counter, flags);
    return;
  }
#endif

Android's CMakeLists.txt already handles this (lines 18-22) with -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 ..., but the iOS podspec doesn't.

This PR adds conditional GCC_PREPROCESSOR_DEFINITIONS scoped to [sdk=iphonesimulator*][arch=x86_64], mirroring the Android approach. Blake3 falls back to its portable C implementation (the SIMD paths were never reachable on the simulator anyway).

  • Device builds (ARM64): unaffected — scoped to simulator SDK only
  • ARM64 simulator: unaffected — scoped to x86_64 arch only

Related

Testing

  • Applied this fix as a pnpm patch on v1.0.9, ran EAS Build with development-simulator profile (x86_64 iOS Simulator) — build now succeeds where it previously failed with undefined symbols

PR margelo#884 excluded blake3_neon.c for x86_64 simulator, but the x86 SIMD
implementations (AVX-512, AVX2, SSE4.1, SSE2) still cause linker errors.

The .c source files (blake3_avx512.c, etc.) are already excluded from
compilation via exclude_files. However, blake3_dispatch.c forward-declares
and calls those functions guarded by #if !defined(BLAKE3_NO_AVX512), so
the compiler still emits references to symbols whose implementations
don't exist — causing "Undefined symbols" at link time.

Android's CMakeLists.txt already handles this correctly (lines 18-22)
by defining -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 etc. for x86/x86_64.
This commit mirrors that approach for iOS via xcconfig preprocessor
definitions scoped to iphonesimulator SDK + x86_64 arch.

Fixes margelo#918
@stefan-garofalo stefan-garofalo force-pushed the fix/ios-blake3-x86_64-simd-symbols branch from 84d1dd6 to fd24f0d Compare February 12, 2026 10:31
Copy link
Collaborator

@boorad boorad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@boorad boorad merged commit 9cd067e into margelo:main Feb 12, 2026
@stefan-garofalo stefan-garofalo deleted the fix/ios-blake3-x86_64-simd-symbols branch February 12, 2026 23:02
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.

iOS x86_64 simulator: undefined BLAKE3 SIMD symbols (AVX-512, AVX2, SSE) on v1.0.9

2 participants