Could not build Objective-C module 'CoreGraphics' - ios

I'm getting the following error when trying to run any of my unit or UI tests. Doesn't happen when running the application itself. The error message is shown below:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: note: while building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:
#include <CoreFoundation/CFBase.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreFoundation.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
#include <CoreFoundation/CFBase.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
#include <Block.h>
^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:
#include "leveldb/iterator.h"
^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:
#include "leveldb/slice.h"
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/slice.h:21:10: error: 'string' file not found
#include <string>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreGraphics.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
#include <CoreGraphics/CGBase.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
^
<unknown>:0: error: could not build Objective-C module 'CoreGraphics'
I'm using Xcode 9 in Swift 3.2 mode and CocoaPods. I'm using Firebase and FirebaseUI, which has leveldb as a dependency. You can see that the error is first triggered in leveldb/slice.h, which cannot find the string file.
I have tried the following up to this point:
Clean (Shift + CMD + K)
Remove DerivedData
Clean Build Folder...
Allow Non-Modular Includes In Framework Modules in Build Settings.
pod deintegrate, pod clean pod install.
For what it's worth, here's the error in the Issue Navigator:
Any suggestions?

This looks similar to a CocoaPods issue that was fixed in CocoaPods 1.4.0. Search paths were not properly set for unit test targets.
Try updating to the CocoaPods 1.4.0 beta and rerun pod update
Or use a comparable workaround to the one described here for the leveldb path:
Add "${PODS_ROOT}/leveldb-library/include" to your Tests target only under Build Settings -> Header Search Paths

Related

"fatal error: 'vector' file not found" while xcode tflite building

I'm developping an ios app with flutter and i've come accross a xcode build error while building tflite module
Xcode's output: ↳ === BUILD TARGET Runner OF PROJECT Runner WITH
CONFIGURATION Debug === While building module 'tflite' imported
from /test_app/ios/Runner/GeneratedPluginRegistrant.m:8:
In file included from <module-includes>:1: In file included
from /app/build/ios/Debug-iphoneos/tflite/tflite.framework/Headers
/tflite-umbrella.h:13: /test_app/build/ios/Debug-iphoneos/tflite
/tflite.framework/Headers/ios_image_load.h:1:10: fatal error: 'vector'
file not found #include <vector> ^~~~~~~~ 1 error generated.
/test_app/ios/Runner/GeneratedPluginRegistrant.m:8:9:
fatal error: could not build module 'tflite'
#import <tflite/TflitePlugin.h> ~~~~~~~^ 2 errors generated.
I found an answer from a github issue:
Open ios/Runner.xcworkspace in Xcode, click Runner > Tagets > Runner > Build Settings, search Compile Sources As, change the value to Objective-C++
Thanks to shaqian https://github.com/shaqian/flutter_tflite/issues/7#issuecomment-440128884

How to fix “swift package generate-xcodeproj” results in manifest parse error?

I'm new to Swift and the Package Manager. I'm following a tutorial that generates the Xcode project file, but I get errors when I run "swift package generate-xcodeproj" (or "swift package update" for that matter). Below is the output.
It looks like it doesn't recognise the 'uuid_string_t' type in hfs_format.h header file.
Any ideas on how to solve this? I'm using Xcode 10.2 and Swift 5 on macOS 10.14.4. My Xcode Command Line Tools setting under the Location Preferences tab is set to 10.2.
/Users/rayscott/Developer/Source/Swift/TCPClient: error: manifest parse error(s):
:353:9: note: in file included from :353:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:794:2: error: unknown type name 'uuid_string_t'
uuid_string_t ext_jnl_uuid;
^
:353:9: note: in file included from :353:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:796:20: error: use of undeclared identifier 'uuid_string_t'; did you mean 'uuid_variant'?
char reserved[JIB_RESERVED_SIZE];
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:787:61: note: expanded from macro 'JIB_RESERVED_SIZE'
#define JIB_RESERVED_SIZE ((32*sizeof(u_int32_t)) - sizeof(uuid_string_t) - 48)
^
/usr/local/include/uuid/uuid.h:98:5: note: 'uuid_variant' declared here
int uuid_variant(const uuid_t uu);
^
:0: error: could not build Objective-C module 'Darwin'
I had the same issue after installing Xcode 10.2 and macOS 10.14.4. Solution for me was to run the following commands in Terminal:
brew doctor, and fix the mentioned issues
sudo xcode-select --reset
After executing these steps I did a reboot, and build started to work again.

React-native 0.57 ios limits file not found could not build module CoreFoundation

RN 0.57.1
RN-cli 2.0.1
xCode: 9.4.1 (9F2000) or xCode 10
After an update of RN from 0.56 to 0.57.0 (or 0.57.1) I get a lot of could not build module 'CoreFoundation' or could not build module Foundation or limits file not found
I followed exactly the steps from RN doc for this update.
I tried removing ios/build folder, cleaning cache, re-installing everything but nothing worked.
▸ Building BunteMobile/OneSignalNotificationServiceExtension [Debug] ▸
Check Dependencies ▸ Compiling NotificationService.m
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10:
'limits' file not found
#include <limits>
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10:
'limits' file not found
#include <limits>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.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/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10:
could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10:
could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:8:9:
could not build module 'Foundation'
#import <Foundation/Foundation.h>
If I remove the OneSignalNotificationServiceExtension instead of 7
errors I get another 15 errors in other parts of the project:
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10:
'limits' file not found
#include <limits>
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10:
'limits' file not found
#include <limits>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.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/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10:
could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10:
could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Users/myuser/Desktop/projects/mobileapp/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:8:9:
could not build module 'Foundation'
#import <Foundation/Foundation.h>
The only workaround that I found is to downgrade RN back to 0.56...
According to the RN team answer from here
https://github.com/facebook/react-native/issues/21482
changing all babel deps to 7 should fix the issue but even after an npx babel-ugrade -w and a reinstall of node modules + cache clean I get the same errors.
but still same problems.
Should any with header search paths be updated in extensions/ios build settings after update to 0.57?
I've spent 3 days with this IOS building issue....
Note: I was able to build android after the upgrade of RN and babel.
React-native git associated ticket:
https://github.com/facebook/react-native/issues/21482
To fix all these errors I had to remove React and ReactCommon from Project Header Search paths and from OneSignalNotificationServiceExtension target header search paths.
1) Removing from project header search paths:
The crashes were related to limits, CoreFoundation, Foundation and CoreGraphics.
I went to Project Header Search Paths and removed the React and ReactCommon dependencies from there.
This is how my project header search paths looks now:
2) Removing from one-signal extension: (Optional, if you don't have any extension you don't have to do this)
This is how the paths of that extension used to look when crashing:
This is how the target of that extension looks now:
Note: I haven't changed anything in the project target header search paths.
I am not sure what changed in RN 0.57, why it was crashing now in 0.57, how this header search paths should be in extensions, project and target. Why previously having React and ReactCommon there worked and why now it is not working anymore.
My project was created 3 years ago and had many RN updates. It is possible that at some point React and ReactCommon were needed in the project header search paths.
As I wrote in my question, this problem was signaled in RN github too,
more details can be found here:
https://github.com/facebook/react-native/issues/21482#issuecomment-427815231

LLDB Issue with FBSDK, whenever I put a breakpoint I get an error and I'm unable to print any variable

Whenever I put a breakpoint and try to access any variable I get this error.
If I try to print a variable in the console, I get this error:
(lldb) p someVar
error: Error in auto-import:
failed to get module 'Jogabo' from AST context:
/Users/pg/Jogabo/app-v2/ios- app/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h:21:9: note: while building module 'FBSDKCoreKit' imported from /Users/pg/Jogabo/app-v2/ios- app/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h:21:
#import <FBSDKCoreKit/FBSDKButton.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h"
^
/Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:9: note: in file included from /Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:
#import "FBSDKAppLinkResolver.h"
^
/Users/pg/Jogabo/app-v2/ios- app/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h:26:1 0: error: include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'
# import <Bolts/BFAppLinkResolving.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h"
^
/Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:9: note: in file included from /Users/pg/Jogabo/app-v2/ios-app/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:
#import "FBSDKLoginButton.h"
^
/Users/pg/Jogabo/app-v2/ios- app/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h:21:9: error: could not build module 'FBSDKCoreKit'
#import <FBSDKCoreKit/FBSDKButton.h>
^
could not build Objective-C module 'FBSDKLoginKit'A fatal parse error has occurred. LLDB may become unstable; please restart your debug session as soon as possible.

Can't debug my iOS project since updating to cocoa pods to use_frameworks! for Swift

After cocoapods 0.38.0 I updated my project to use_frameworks! so that I can make use of Swift modules.
Now whenever I try and debug via lldb I get the following error:
error: Error in auto-import:
failed to get module 'my-app-name' from AST context:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h"
^
/Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:9: note: in file included from /Path/To/Project/Pods/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h:6:
#import "FBSDKAppLinkResolver.h"
^
/Path/To/Project/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h:26:10: error: include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'
# import <Bolts/BFAppLinkResolving.h>
^
could not build Objective-C module 'FBSDKCoreKit'<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h"
^
/Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:9: note: in file included from /Path/To/Project/Pods/Target Support Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h:3:
#import "FBSDKLoginButton.h"
^
A fatal parse error has occurred. LLDB may become unstable; please restart your debug session as soon as possible.
I did a bit of digging and found that if you set Allow Non-modular Includes in Framework Modules to yes for the FBSDKCoreKit target in the Pods project, that fixes the LLDB errors.

Resources