Repository navigation
Conversation
Xcode does not export user-defined build settings as environment variables for invoked scripts, so the CCACHE_BINARY value set on the project by react_native_post_install never reached ccache-clang.sh / ccache-clang++.sh. Because the original exec command collapsed an empty $CCACHE_BINARY, builds silently invoked clang directly and ccache was never used. Fall back to a PATH lookup when CCACHE_BINARY is unset, and only prepend ccache when an executable is actually available so projects without ccache still build. Fixes #55381
Xcode does not export the CCACHE_BINARY build setting to the compiler wrapper, so RN's ccache-clang.sh ran plain clang. Backport react/react-native#56612 via a bun patch and drop the explicit modules workaround. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label. |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
Any news? |
|
Thanks for putting this together, @wildan-m, and for keeping it going. Tested on React Native 0.88.1 with Xcode 27.2: without this change, One gap: builds started from the Xcode app don't have Homebrew on if [ -z "$CCACHE_BINARY" ]; then
for candidate in "$(command -v ccache)" /opt/homebrew/bin/ccache /usr/local/bin/ccache; do
if [ -x "$candidate" ]; then
CCACHE_BINARY=$candidate
break
fi
done
fiA more general option: since |
|
@migueldaipre @PsukheDelos I've moved this to #60199. GitHub locked my fork during the move to react/react-native and I couldn't push to it, so I had to delete and re-create the fork, which closed this PR. #60199 adds the Homebrew fallback ( |
Summary:
When ccache is enabled for an iOS build via
react_native_post_install(orUSE_CCACHE=1),packages/react-native/scripts/cocoapods/utils.rbwires upccache-clang.sh/ccache-clang++.shasCC/CXXand writes the resolved ccache path to aCCACHE_BINARYXcode build setting. The shell wrappers then runexec $CCACHE_BINARY clang "$@".The problem: as of recent Xcode versions (confirmed at least on Xcode 26.2 by the issue reporter, and reproducible by inspection — Xcode does not export user-defined build settings as environment variables for invoked scripts),
$CCACHE_BINARYis empty when the wrapper runs. Because the variable was unquoted, the empty value collapsed and the line silently becameexec clang "$@"— so ccache was never invoked, even though everything else was set up correctly.This change makes the wrappers fall back to
command -v ccachewhenCCACHE_BINARYis unset, and only prepends ccache when an executable is actually available so projects without ccache installed still build.Fixes #55381
Changelog:
[IOS] [FIXED] - ccache is no longer silently bypassed on iOS builds when Xcode does not propagate the
CCACHE_BINARYuser-defined build setting to scripts.Test Plan:
Smoke-tested the modified wrappers under four scenarios with a fake
ccacheonPATH:CCACHE_BINARYset explicitly — ccache is invoked. ✅CCACHE_BINARYunset,ccacheonPATH(the bug case) — wrapper now finds and invokes ccache via the PATH fallback. ✅CCACHE_BINARYunset,ccacheonPATH— same behaviour forccache-clang++.sh. ✅clang/clang++invocation, so projects without ccache still build (no regression vs. previous silent-bypass behaviour, just no longer a build error). ✅shellcheckis clean on both files.