[SDK 55] iOS build from source fails on Xcode 26.4 · Issue #44229 · expo/expo · GitHub
Skip to content

[SDK 55] iOS build from source fails on Xcode 26.4 #44229

@zhenyu-hong

Description

@zhenyu-hong

Summary

iOS build fails when using Expo SDK 55 (React Native 0.83.2) with Xcode 26.4 and buildReactNativeFromSource: true. The bundled fmt 11.0.2 library produces 5 compilation errors related to consteval.

This only affects projects that build React Native from source. Prebuilt binaries are not affected.

Environment

  • Expo SDK: 55
  • React Native: 0.83.2
  • fmt: 11.0.2 (bundled via react-native/third-party-podspecs/fmt.podspec)
  • Xcode: 26.4 (Build version 17E192)
  • macOS: Darwin 25.3.0

Error Output

❌  (ios/Pods/fmt/include/fmt/format-inl.h:59:24)
  57 |   auto it = appender(out);
  58 |   if (message.size() <= inline_buffer_size - error_code_size)
> 59 |     fmt::format_to(it, FMT_STRING("{}{}"), message, SEP);
     |                        ^ call to consteval function 'fmt::basic_format_string<char, 
     fmt::basic_string_view<char> &, const char [3]>::basic_format_string<FMT_COMPILE_STRING, 0>' 
     is not a constant expression

5 similar errors all in format-inl.h, all caused by FMT_STRING macro using consteval.

Root Cause

fmt 11.0.2 defines FMT_USE_CONSTEVAL=1 when it detects Clang ≥ 11.01 (see fmt/base.h line 128). However, Apple Clang shipped with Xcode 26.4 enforces stricter consteval rules than previous versions, causing FMT_STRING macro expansions to fail.

Related upstream issues:

Reproduction

npx create-expo-app@latest fmt-test --template blank-typescript
cd fmt-test
npx expo install expo-build-properties

Then update app.json to enable building React Native from source:

{
  "expo": {
    "plugins": [
      ["expo-build-properties", {
        "ios": {
          "buildReactNativeFromSource": true
        }
      }]
    ]
  }
}

Then build:

npx expo run:ios  # on Xcode 26.4 — fails with 5 fmt consteval errors

Note: Without buildReactNativeFromSource: true, the build succeeds because prebuilt binaries are used and fmt is not compiled from source.

Workaround

Create an Expo Config Plugin that patches the Podfile to disable consteval in fmt:

// plugins/ios/withFmtFix.js
const { withDangerousMod } = require("@expo/config-plugins");
const fs = require("node:fs");
const path = require("node:path");

const withFmtFix = (config) => {
  return withDangerousMod(config, [
    "ios",
    async (config) => {
      const podfilePath = path.join(
        config.modRequest.platformProjectRoot,
        "Podfile"
      );
      if (!fs.existsSync(podfilePath)) return config;

      let content = fs.readFileSync(podfilePath, "utf-8");
      if (content.includes("FMT_USE_CONSTEVAL")) return config;

      const patchCode = `
    # Fix fmt 11.0.2 consteval compilation error with Xcode 26.4+
    fmt_base = File.join(installer.sandbox.pod_dir('fmt'), 'include', 'fmt', 'base.h')
    if File.exist?(fmt_base)
      content = File.read(fmt_base)
      patched = content.gsub(/^#\\s*define FMT_USE_CONSTEVAL 1$/, '# define FMT_USE_CONSTEVAL 0')
      if patched != content
        File.chmod(0644, fmt_base)
        File.write(fmt_base, patched)
      end
    end`;

      content = content.replace(
        /(react_native_post_install\([^)]*\)[\s\S]*?\))([\s\n]*end[\s\n]*end)/,
        `$1\n${patchCode}\n$2`
      );
      fs.writeFileSync(podfilePath, content);
      return config;
    },
  ]);
};

module.exports = withFmtFix;

Then add "./plugins/ios/withFmtFix" to the plugins array in app.config.ts.

Expected Behavior

npx expo run:ios should compile successfully on Xcode 26.4, even with buildReactNativeFromSource: true.

Suggested Fix

Either:

  1. Bump fmt to a version that handles newer Apple Clang correctly, or
  2. Add FMT_USE_CONSTEVAL=0 to fmt's build settings in the generated Podfile template when building from source
Pinned by kitten

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions