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

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

Related

Unable to run Flutter App on iOS when using Firebase. Android seems to be working but iOS throws multiple errors

So I followed the instructions on adding Firebase to Flutter and although things work on Android, I am unable to build on the ios emulator. I get some xcode errors. I have tried deleting both ios/Pods directory and the Podfile.lock file, then using the flutter clean command. But I still get these errors. I have tried doing research but nothing I have found has helped. Here are the errors i get when I try to test on the iOS emulator.
Thank you in advance for the help.
Errors From Flutter Run:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 130.2s
Failed to build iOS app
Error output from Xcode build:
↳
2021-03-26 18:45:52.768 xcodebuild[15465:79135] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-17705/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
Details: (null) deviceType from 00008101-001945163408001E was NULL when -platform called.
Object: <DTDKMobileDeviceToken: 0x7f963f7d3f80>
Method: -platform
Thread: <NSThread: 0x7f963b713cc0>{number = 3, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2021-03-26 18:45:52.947 xcodebuild[15465:79134] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-17705/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
Details: (null) deviceType from 00008101-001945163408001E was NULL when -platform called.
Object: <DTDKMobileDeviceToken: 0x7f963f7d3f80>
Method: -platform
Thread: <NSThread: 0x7f963f725360>{number = 7, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
Xcode's output:
↳
While building module 'firebase_core' imported from /Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-1.0.1/ios/Classes/FLTFirebaseAuthPlugin.m:5:
In file included from <module-includes>:1:
In file included from /Users/dev/AndroidStudioProjects/aul/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.0.2/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.0.2/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/dev/AndroidStudioProjects/aul/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/dev/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-1.0.1/ios/Classes/FLTFirebaseAuthPlugin.m:5:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Errors from Xcode:
/Users/dev/AndroidStudioProjects/aul/build/ios/Debug-iphonesimulator/firebase_core/firebase_core.framework/Headers/FLTFirebasePlugin.h:9:9: Include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/dev/AndroidStudioProjects/aul/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
/Users/dev/AndroidStudioProjects/aul/build/ios/Debug-iphonesimulator/firebase_auth/firebase_auth.framework/Headers/FLTFirebaseAuthPlugin.h:12:9: Could not build module 'firebase_core'
/Users/dev/AndroidStudioProjects/aul/ios/Runner/GeneratedPluginRegistrant.m:8:9: Could not build module 'firebase_auth'
In my iOS/Runner/AppDelegate.swift file I was initiating Firebase there, which is not needed. I also added the the firebase pod plugins to my Podfile. Once I removed these things it started to work.

Flutter iOS build failing on BigSur, XCode 12

Flutter iOS build fails due to issues with headers.
I followed the simple steps mentioned on flutter.dev for launching an app on iOS simulator. I've had no problems working with flutter on Android/Web, but this is the first time I've tried running it on iOS.
Summary of error - (Complete Error: https://gist.github.com/mannprerak2/520f8a749431a50b8472783c71d67dda)
...
#import "Headers/CoreMedia.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h:15:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h:15:
#include <CoreMedia/CMFormatDescription.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:26:10: error: could not build module 'CoreAudio'
#include <CoreAudio/CoreAudioTypes.h>
^
/Users/prerakmann/development/test_ios/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/prerakmann/development/test_ios/ios/Runner/Runner-Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"
^
/Users/prerakmann/development/test_ios/ios/Runner/GeneratedPluginRegistrant.h:8:9: error: could not build module 'Flutter'
#import <Flutter/Flutter.h>
^
192 errors generated.
<unknown>:0: error: failed to emit precompiled header '/Users/prerakmann/Library/Developer/Xcode/DerivedData/Runner-ahrcvwuwhqnepxdcpfsagztcuwrr/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_1QEOMJ6SUMBGB-clang_3BG5Q8JCTPBV5.pch' for bridging header '/Users/prerakmann/development/test_ios/ios/Runner/Runner-Bridging-Header.h'
384 errors generated.
<unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
...
System: Macbook Pro 13 (2020), BigSur 11.2.1, Xcode 12.4
Flutter: Tried on the latest stable and beta channel.
Simulator: Tried on iOS 8, iOS 12.
Steps to reproduce: Create a new flutter app, run it.
Turns out this was happening due to CPATH being defined like this.
╰─$ echo $CPATH
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
A temporary fix is to set CPATH= in current terminal window, run flutter clean, and then run the app.

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.

Flutter unique_identified library issue?

I have a problem that when I used a library for flutter application to get the unique_id a problem arose where I can't do the build due that x-code can't import the required libraries even after pod installation was successful ,
Here is a screenshot of what the error would look like :
here is the exception stack trace when doing dart build :
Launching lib/main.dart on iPhone XR in debug mode...
Running pod install...
Starting Xcode build...
Xcode build done. 41.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/mac/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/unique_identifier-0.0.3/ios/Classes/UniqueIdentifierPlugin.m:2:9: fatal error: 'unique_identifier/unique_identifier-Swift.h' file not found
#import <unique_identifier/unique_identifier-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/mac/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-0.2.1/ios/Classes/FirebaseMessagingPlugin.m:146:75: warning: 'token' is deprecated: Use instanceIDWithHandler: instead. [-Wdeprecated-declarations]
[_channel invokeMethod:#"onToken" arguments:[[FIRInstanceID instanceID] token]];
^
In module 'FirebaseInstanceID' imported from /Users/mac/Desktop/test/ios/Pods/Headers/Private/Firebase/Firebase.h:46:
/Users/mac/Desktop/test/ios/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h:201:30: note: 'token' has been explicitly marked deprecated here
- (nullable NSString *)token __deprecated_msg("Use instanceIDWithHandler: instead.");
^
In module 'Foundation' imported from Headers/Private/FirebaseCore/FIRAnalyticsConfiguration.h:17:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/sys/cdefs.h:180:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
^
1 warning generated.
*** Update on the above [ the error above was corrected by removing the file and adding them again manually but now another problem appeared , when the code that get the unique Identifier is called exception happen ]
I appreciate the help
Regards,

Could not build Objective-C module 'CoreGraphics'

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

Resources