Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 10 "Could not build module Darwin / Foundation / CoreFoundation" etc

After switching to Xcode 10 (Have to use legacy build system for now), I started getting errors shown below. Locally I was able to fix them by pretty much cleaning everything I can i.e. Derived Data / Build etc...

Debug and Release runs in Xcode run fine for me, however I've been struggling to solve this issue in our CI (bitrise).

We use Fastlane and our lane has steps to clear derived data and perform clean build.

clear_derived_data
build_ios_app(
  workspace: "application.xcworkspace",
  scheme: "application",
  clean: true
)

Yet these errors keep happening (these are few examples, there are around 30 errors like this following one another and pointing to same packages like Darwin etc..):

❌  /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/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6: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>
 ~~~~~~~~^

EDIT: Does legazy build setting persist i.e. if set in our Xcode and committed to git, will ci also use legacy build system?

like image 733
Ilja Avatar asked Sep 28 '18 07:09

Ilja


2 Answers

  1. If you are using Bitrise, go to 'Xcode Archive & Export for iOS' step.
  2. Scroll down and expand the 'Debug' section. Scroll down to 'Do a clean Xcode build before the archive?' and change this to 'yes'.
  3. Save your settings start a new build, do not rebuild as it will use the old settings.
like image 90
Hugo Pretorius Avatar answered Oct 10 '22 07:10

Hugo Pretorius


I resolve this issue by setting the build system to Legacy.

Open the PROJECT_NAME.workspace file

Then in the top menu select File > Workspace Settings

Then change Build System to Legacy Build System

like image 1
Deyson Avatar answered Oct 10 '22 06:10

Deyson