[ios] Fails to build with default XCode 10 settings

Issue

Below is set of errors that pops up during Compiling RNFirebaseFunctions.m step of the build. Most suggestions online ask to clear build / derived data folder, but it doesn’t seem to help.

▸ Building RNFirebase/RNFirebase [Release]
▸ Check Dependencies
▸ Compiling RNFirebaseFunctions.m

❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
#include <sys/types.h>
 ~~~~~~~ ^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/dispatch/dispatch.h:25:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/os/object.h:25:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/objc/objc.h:31:10: could not build module 'Darwin'
#include <sys/types.h>      // for __DARWIN_NULL
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:27:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h:19:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
❌  /Users/vagrant/git/packages/skimitar-app/node_modules/react-native-firebase/ios/RNFirebase/functions/RNFirebaseFunctions.h:3:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:8:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:11:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: could not build module 'Foundation'
#include <Foundation/Foundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h:8:9: could not build module 'Darwin'
#import <os/availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:12:10: could not build module 'Darwin'
#include <sys/cdefs.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImageDefines.h:10:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:16:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:11:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTDefines.h:12:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~~^
▸ Compiling RNFirebaseInstanceId.m
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
#include <sys/types.h>
         ^~~~~~~~
** ARCHIVE FAILED **

screenshot 2018-11-14 at 09 51 01

Environment

  1. Application Target Platform: iOS
  1. Development Operating System: macOS Mojave 10.14
  1. Build Tools: XCode 10 (set to legacy build setting)
  1. React Native version: 0.57.1
  1. React Native Firebase Version: 5.0.0-rc5
  1. Firebase Module: Functions?
  1. Are you using typescript? yes

Loving react-native-firebase? Please consider supporting them with any of the below:

11 thoughts on “[ios] Fails to build with default XCode 10 settings

  1. Also having mostly random build failures here, when building from scratch on CircleCI (with Xcode 9.4.1, Firebase 5.9.0, react-native-firebase 5.0.0)

    The firebase-ios-sdk issue referenced above has a hint that this might be related to the header map setting? The error messages I’m getting are a bit undeterministic but along the lines of

    ❌  /Users/distiller/user/projects/xyz/node_modules/react-native-firebase/ios/RNFirebase/instanceid/RNFirebaseInstanceId.h:3:9: could not build module 'Foundation'
    
    #import <Foundation/Foundation.h>
     ~~~~~~~~^
    
    
    ▸ Compiling RNFirebaseAdMobRewardedVideo.m
    ▸ Compiling RCTConvert+UIBackgroundFetchResult.m
    
    ** ARCHIVE FAILED **
    
    
    The following build commands failed:
    CompileC /Users/distiller/Library/Developer/Xcode/DerivedData/xyz-ankmumdxtthuucctmkmqtifwqzxf/Build/Intermediates.noindex/ArchiveIntermediates/Staging/IntermediateBuildFilesPath/RNFirebase.build/Release-iphoneos/RNFirebase.build/Objects-normal/armv7/RNFirebaseInstanceId.o RNFirebase/instanceid/RNFirebaseInstanceId.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    (1 failure)
    [08:07:00]: Exit status: 65
    
  2. @hugopretorius72 @gabsschneider @julo15 @codeflows This issue is not related to react-native-firebase per se, after tinkering with it for a while I believe its something to do with XCode 10’s legacy build system not being used on CI.

    Me and my friend both set our XCode’s to use legacy build system, it changed some entry in plist file, so we thought that it will persist everywhere, however when we pulled our repo on a new machine that used fresh version of XCode, it was not set to build system.

    Easiest workaround atm is to deploy via non-ci i.e. straight from XCode or revert to earlier react version.

    There is also this response I got from bitrise ci support

    According to the Xcode documentation you can disable the modern buildsystem using the -UseModernBuildSystem=0

    Thats a flag xcode cli tools use ^ I think you can specify it in fastlane or ci tool you are using to archive your apps.

    Also, this will likely be resolved with react-native 0.58 as there are efforts being made to make it work with XCode’s new build system.
    facebook/react-native#21458

    Hope this helps 🙂

    EDIT: Although it seems you guys are getting same error on v9 of XCode, so I’m not entirely sure that this is what is causing the issue.

  3. I’ve been having the same issue intermittently (in fact, most of the time) even with XCode 9.

    Here’s an example of the failing output:

    ▸ Building library libReactNativeTestFairy.a
    ▸ Building library libReactNativeTestFairy.a
    ▸ Building RNFirebase/RNFirebase [Release]
    ▸ Check Dependencies
    ▸ Compiling RNFirebaseFunctions.m
    
    ❌  /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
    
    #include <sys/types.h>
             ^~~~~~~~
    

    And here’s a link to an example failing build:

    https://circleci.com/gh/dwmkerr/gameboard/945

    Reproduction Steps

    Push any code to build on CircleCI, it will most likely fail with errors similar to the above. However, it will not fail when building locally. I’m using Fastlane. Here’s a link to the repo:

    https://github.com/dwmkerr/gameboard/

    And the Fastfile:

    https://github.com/dwmkerr/gameboard/blob/master/fastlane/Fastfile

    To run locally, just use make ios.

    What I’ve Tried

    1. Cleaning Caches / Derived Data
    2. Upgrading to XCode 10
    3. Forcing ‘use legacy build’ with xcargs: "-UseModernBuildSystem=0"
    4. Forcing ‘use legacy build’ with xcargs: "-UseNewBuildSystem=NO"
    5. Making sure the xcsettings are committed, as per @Salakar‘s suggestion

    I just can’t get these builds to work now on CircleCI, any other suggestions for what could be going on?

    I think this is a RNFirebase issue, if it was simply due to race conditions with the build, I’d expect to see different failures. I have consistently seen the failure with the exact same step, just like @IljaDaderko has. I’d suggest we re-open the issue.

  4. I’d like to have this re-opened as well, our situation is similar to @dwmkerr‘s. Xcode 9, Circle CI, Fastlane. Working locally 100%% of the time but never on the CI.

  5. @Salakar I think this is worth re-opening now, here is additional context:
    react-native@0.57.5 was released that claims to fix XCode 10’s build issues i.e. we can use default one instead of legacy now:
    https://twitter.com/Kelset/status/1062390902616920065

    However this error keeps happening, now on any build either dev / prod / local or ci if new build system is enabled. Whats curious is that a lot of react / third party libs compile fine before it hits RNFirebase, leading me to think that this might be specific to the library?

  6. I’m seeing this issue on my CI only (bitrise). I’m using fastlane. Everything was fine until I added a cocoapod subspec for using the Firebase database. I build release builds on my CI, but I suspect it happens for debug builds as well.

    Locally, I saw the issue when I was using the modern build system. I’ve manually changed it in the workspace and am passing in the appropriate flags to force it to use the legacy build system. No luck.

  7. I managed to figure out my issue, I think. In the end it was not related to react-native-firebase, kind of. Another library that I used had its header search paths set to /ios/Pods/** which meant that that library would look for headers everywhere in all the Pods. Limiting that library’s header search path to /ios/Pods/[libraryname] fixed the issue.

    Maybe @seblau that react-native-flurry lib also has something wrong with its header search paths.

Comments are closed.

[ios] Fails to build with default XCode 10 settings

Issue

Below is set of errors that pops up during Compiling RNFirebaseFunctions.m step of the build. Most suggestions online ask to clear build / derived data folder, but it doesn’t seem to help.

▸ Building RNFirebase/RNFirebase [Release]
▸ Check Dependencies
▸ Compiling RNFirebaseFunctions.m

❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
#include <sys/types.h>
 ~~~~~~~ ^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/dispatch/dispatch.h:25:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/os/object.h:25:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/usr/include/objc/objc.h:31:10: could not build module 'Darwin'
#include <sys/types.h>      // for __DARWIN_NULL
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:27:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h:19:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
❌  /Users/vagrant/git/packages/skimitar-app/node_modules/react-native-firebase/ios/RNFirebase/functions/RNFirebaseFunctions.h:3:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:8:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:11:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: could not build module 'Foundation'
#include <Foundation/Foundation.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h:8:9: could not build module 'Darwin'
#import <os/availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:12:10: could not build module 'Darwin'
#include <sys/cdefs.h>
 ~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImageDefines.h:10:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:16:10: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:11:10: could not build module 'Darwin'
#include <stdbool.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTDefines.h:12:10: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~~^
▸ Compiling RNFirebaseInstanceId.m
❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
#include <sys/types.h>
         ^~~~~~~~
** ARCHIVE FAILED **

screenshot 2018-11-14 at 09 51 01

Environment

  1. Application Target Platform: iOS
  1. Development Operating System: macOS Mojave 10.14
  1. Build Tools: XCode 10 (set to legacy build setting)
  1. React Native version: 0.57.1
  1. React Native Firebase Version: 5.0.0-rc5
  1. Firebase Module: Functions?
  1. Are you using typescript? yes

Loving react-native-firebase? Please consider supporting them with any of the below:

6 thoughts on “[ios] Fails to build with default XCode 10 settings

  1. I’ve been having the same issue intermittently (in fact, most of the time) even with XCode 9.

    Here’s an example of the failing output:

    ▸ Building library libReactNativeTestFairy.a
    ▸ Building library libReactNativeTestFairy.a
    ▸ Building RNFirebase/RNFirebase [Release]
    ▸ Check Dependencies
    ▸ Compiling RNFirebaseFunctions.m
    
    ❌  /Applications/Xcode-10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: could not build module 'Darwin'
    
    #include <sys/types.h>
             ^~~~~~~~
    

    And here’s a link to an example failing build:

    https://circleci.com/gh/dwmkerr/gameboard/945

    Reproduction Steps

    Push any code to build on CircleCI, it will most likely fail with errors similar to the above. However, it will not fail when building locally. I’m using Fastlane. Here’s a link to the repo:

    https://github.com/dwmkerr/gameboard/

    And the Fastfile:

    https://github.com/dwmkerr/gameboard/blob/master/fastlane/Fastfile

    To run locally, just use make ios.

    What I’ve Tried

    1. Cleaning Caches / Derived Data
    2. Upgrading to XCode 10
    3. Forcing ‘use legacy build’ with xcargs: "-UseModernBuildSystem=0"
    4. Forcing ‘use legacy build’ with xcargs: "-UseNewBuildSystem=NO"
    5. Making sure the xcsettings are committed, as per @Salakar‘s suggestion

    I just can’t get these builds to work now on CircleCI, any other suggestions for what could be going on?

    I think this is a RNFirebase issue, if it was simply due to race conditions with the build, I’d expect to see different failures. I have consistently seen the failure with the exact same step, just like @IljaDaderko has. I’d suggest we re-open the issue.

  2. I’d like to have this re-opened as well, our situation is similar to @dwmkerr‘s. Xcode 9, Circle CI, Fastlane. Working locally 100%% of the time but never on the CI.

  3. I’m seeing this issue on my CI only (bitrise). I’m using fastlane. Everything was fine until I added a cocoapod subspec for using the Firebase database. I build release builds on my CI, but I suspect it happens for debug builds as well.

    Locally, I saw the issue when I was using the modern build system. I’ve manually changed it in the workspace and am passing in the appropriate flags to force it to use the legacy build system. No luck.

Comments are closed.