Skip to content

Build fails with Xcode 26 + explicit modules: _Builtin_stddef.pcm not found in phlibwebp (vendored libwebp) #579

@Goles

Description

@Goles

Version

3.57.0

Steps to Reproduce

  1. Use Xcode 26.4 (build 17E192) on macOS 26 (Darwin 25.3.0), Apple Silicon.
  2. Create or open an iOS app targeting iOS 26.0 with Swift 6.0.
  3. Add posthog-ios as a Swift Package Manager dependency, version 3.57.0 (also reproduced on 3.50.0).
  4. Resolve packages: xcodebuild -resolvePackageDependencies. Confirms PostHog 3.57.0 + transitive PLCrashReporter 1.12.2.
  5. Build for the iOS Simulator: xcodebuild build -sdk iphonesimulator -arch arm64.
  6. Build fails inside the PostHog package's phlibwebp C target while compiling vendor/libwebp/yuv_sse2.c (and the other yuv_*.c SIMD variants).

The clang invocation passes -fno-implicit-modules and -fmodule-file=_Builtin_stddef=…/ExplicitPrecompiledModules/_Builtin_stddef-…pcm, but that .pcm is never produced. Inspecting ~/Library/Developer/Xcode/DerivedData/<project>/SourcePackages/checkouts/posthog-ios/build/GeneratedModuleMaps-iphonesimulator/ shows only phlibwebp.modulemap and PostHog.modulemapCrashReporter.modulemap is missing.

Two error forms repeat throughout the build log:

fatal error: module map file '.../GeneratedModuleMaps-iphonesimulator/CrashReporter.modulemap' not found
.../usr/lib/clang/21/include/stddef.h:89:2: fatal error: module file '.../ExplicitPrecompiledModules/_Builtin_stddef-…pcm' not found: module file not found

Tried (none fixed it): xcodebuild clean, deleting DerivedData and re-resolving packages, setting CLANG_ENABLE_EXPLICIT_MODULES = NO and SWIFT_ENABLE_EXPLICIT_MODULES = NO at both target and project level, bumping posthog-ios from 3.50.0 → 3.57.0. None propagate to the SPM package's own compilation. The only thing that unblocks the build is the global Xcode default defaults write com.apple.dt.Xcode IDESwiftPackagesEnableExplicitlyBuiltModules NO, which is not a per-project fix.

Expected Result

The PostHog SPM package builds cleanly under Xcode 26 with explicit module builds enabled (the default for iOS 26 / Xcode 26 projects), without requiring the consuming project to disable explicit modules globally. Specifically, the phlibwebp C target should compile vendor/libwebp/*.c against the SDK's standard headers without referencing _Builtin_stddef.pcm (or other _Builtin_*.pcm) files that the explicit-modules pipeline doesn't produce, and CrashReporter.modulemap should be available in the generated module-maps directory the build references.

Actual Result

Build fails inside the PostHog package's phlibwebp C target while compiling vendor/libwebp/yuv_sse2.c (and the other yuv_*.c SIMD variants). Two error forms repeat throughout the log:

fatal error: module map file '.../SourcePackages/checkouts/posthog-ios/build/GeneratedModuleMaps-iphonesimulator/CrashReporter.modulemap' not found
.../usr/lib/clang/21/include/stddef.h:89:2: fatal error: module file '.../SourcePackages/checkouts/posthog-ios/build/ExplicitPrecompiledModules/_Builtin_stddef-2WHHVO9DDU3HYIK85SE9PKH9I.pcm' not found: module file not found
   89 | #include <__stddef_header_macro.h>
      |  ^

The clang invocation passes -fno-implicit-modules and -fmodule-file=_Builtin_stddef=…/ExplicitPrecompiledModules/_Builtin_stddef-…pcm — but the .pcm files are never produced inside the package's build directory. Listing ~/Library/Developer/Xcode/DerivedData/<project>/SourcePackages/checkouts/posthog-ios/build/GeneratedModuleMaps-iphonesimulator/ shows only phlibwebp.modulemap and PostHog.modulemapCrashReporter.modulemap is missing entirely. The triggering include chain is vendor/libwebp/yuv_sse2.cph_yuv.hph_dsp.hph_cpu.h<stddef.h>. The build terminates with ** BUILD FAILED ** with no PostHog code ever compiled successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesPull requests that update a dependency filequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions