Search code examples
iosxcodereact-nativecocoapodsios-simulator

After Upgrading React Native with M1. Often get CompileC clang errors. Intermediates.noindex/Pods.build/Debug


After Upgrading React Native to 68.6 and switching back to any branch. Often get CompileC clang errors. I often see this error when either installing new packages, with my package lock or upgrading from version to version with react native.

Some pods are using the wrong target version, but this is not the case when building.

Steps I've tried:

  1. Switching target versions both in xcode and in visual studio. It seems that something gets cached in xcode or the simulator
  2. Using various pieces of my clean start command which is aliased as
watchman watch-del-all && killall -9 node && rm -rf yarn.lock package-lock.json node_modules ios/Pods ios/Podfile.lock android/app/build && npm install && cd ios && pod update && cd .. && npm start -- --reset-cache"
  1. Using pod deintegrate, pod setup, pod init commands. all sorts of pod cache clearing commands
  2. Removing expo modules entirely because it seemed to be related in the past. Xcode still seems to be holding onto some expo modules related code.
  3. Waiting for Indexing | Processing to finish before building
  4. Cleaning builds in xcode, xcodebuild clean, rm -rf ios/build
  5. Closing down simulators, restarting mac, using kill simulator commands such as xcrun simctl shutdown all xcrun simctl erase all or sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
  6. Using patch-package
  7. Changing excluded architectures to arm64 and back again in xcode
  8. Open xcode or terminal with Rosetta , Xcode 14.3 seems to do this internally with a setting for the simulator.
2023-04-04 09:19:19.164 xcodebuild[87551:1680692] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:BE127B8C-C1DA-4AE9-B3DB-101C76E645FE, OS:16.4, name:iPhone 13 }
{ platform:iOS Simulator, id:BE127B8C-C1DA-4AE9-B3DB-101C76E645FE, OS:16.4, name:iPhone 13 }
** BUILD FAILED **


The following build commands failed:
        CompileC /Users/me/repositories/MyMobileApp/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Yoga.build/Objects-normal/arm64/Yoga.o /Users/me/repositories/MyMobileApp/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Yoga' from project 'Pods')
(1 failure)

This is not unique to this Yoga.cpp, this continues to happen seemingly regardless of package. I'm on Xcode 14.3. Android builds just fine and I can usually troubleshoot any android related issues very easily. It does seem to be simulator / pods / xcode related, but I have yet, after all this troubelshooting been able to find an exact culprit. In the past, I've closed things down and sometimes it just works after running a number of steps. I cant remember which step it was that solved the issue. Master of this branch builds in the pipelines, I've had this branch build before, but switching from a different upgraded branch with different packages or versions of react or packages that involve any native ios changes or pod updates and switching back seems to completely mess up my simulator.

This seems to be the related yoga post, but only when moving from a newer react native project and going back to master -> the above error appears Use of bitwise '|' with boolean operands


Solution

  • This seemed to fix it after all the troubleshooting. Just changing and saving it. No need for patch-package. At least locally. Seems Xcode 14.3 related. Use of bitwise '|' with boolean operands