Flutter throws an error when running build or run - ios

I keep getting this when I try to run or run a flutter project
/Users/user1/Projects/projectx/ios/Pods/FBSDKCoreKit_Basics/Sources/FBSDK
CoreKit_Basics/FBSDKUserDataStore.m:19:9: fatal error:
'FBSDKUserDataStore.h' file not found
#import "FBSDKUserDataStore.h"
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
'/Users/user1/Library/Developer/Xcode/DerivedData/Runner-axlixevsrpjdqpcqvk
bkkcevsnce/Build/Products/Debug-iphonesimulator/wakelock/wakelock.framework'

This was caused by an error in one of the dependencies, an update has been released and I was able to run the application.

Related

How fix build error? - Planning build error Xcode 13.4.1

already tried to clean DrivedData and clean the project
I have a compilation error after updating Xcode to version 13.4.1
Using configuration file at '/Users/cmdb-126934/Documents/GitHub/pixchange-ios-v2/configs/Core/.sourcery-core.yml'
Scanning sources...
loadOrParse: 0.7304950952529907
resolution took 0.10656499862670898
combiningTypes: 0.15617001056671143
total: 0.9078500270843506
Found 777 types.
Loading templates...
Loaded 5 templates.
Loading took 0.005128979682922363
Generating code...
error: [1/1] Planning build
I tried deleting DrivedData and Clean Project

Kotlin Multiplatform Mobile unable to run on iOS: Execution failed for task ':shared:compileKotlinIosX64'

I have created fresh project(Hello World) in KMM followed by their official website. In android it works smooth but when I am trying to run in XCode it's giving errors because of which I am unable to build / run the xcode project. I have attached screenshots and logs for my errors. Somehow xcode scheme is not getting generated in the KMM platform that's what I am guessing.
Can anyone please help me understand what am I missing?
Any help would be appriciated.
Following is my dev env:
Xcode 11.4.1
Android 4.1.2
Kotling Plugin version 1.4.30 (stable)
KMM 0.2.0```
XCode Logs:
> Task :shared:compileKotlinIosX64
Downloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler.
Extracting dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz into /Users/fatin/.konan/dependencies
e: java.lang.RuntimeException: Cannot extract archive with dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz.
> Task :shared:compileKotlinIosX64 FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared:compileKotlinIosX64'.
> Compilation finished with errors
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
1 actionable task: 1 executed
Command PhaseScriptExecution failed with a nonzero exit code ```
[![enter image description here][3]][3]
I reached out to community for this and finally found the solution. Here is the link to that issue which I raised and solved this problem.
If anyone else is going through this same issue it mostly cause of corrupted kotlin file.
Also try checking your cmd line tools in XCode as per comments.
Hope this helps someone. Cheers.
If the project doesn't run right away even on opening it from Xcode and shows the shared framework is missing, Then try generating the shared framework for iOS platform using terminal. Navigate to the project folder and execute
Command: ./gradlew packForXcode Now the shared framework should have a xcode-frameworks product and you should be able to build and run the project through Xcode.
This could happen if there are two libraries, where one library was compiled against the different version of the other library than the one currently used in the project. Please check that the project configuration is correct and has consistent versions of dependencies.

Issues with Xcode

I'm trying to build a simple app in Xcode however I'm getting this error saying build failed
:0: error: PCH was compiled with module cache path '/Users/apple/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/5JW54F8EE7JD', but the path is currently '/Users/Neil/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/5JW54F8EE7JD'
:0: error: missing required module 'SwiftShims'
what can I do to solve it?
You can try delete derived data of your app and then clean and build app, you can follow the steps of the following link https://programmingwithswift.com/delete-derived-data-xcode/. Also, you can follow this link Fixing Xcode

Flutter build iOS - BoringSSL-GRPC/, undeclared 'SSL_get_secure_renegotiation_support'; 'GRPC_SHADOW_SSL_get_secure_renegotiation_support'?

In trying to run a basic Flutter demo for Firebase Auth, running into this error output:
error: use of undeclared identifier
'SSL_get_secure_renegotiation_support'; did you mean 'GRPC_SHADOW_SSL_get_secure_renegotiation_support'?
!(SSL_get_secure_renegotiation_support(ssl) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GRPC_SHADOW_SSL_get_secure_renegotiation_support
Steps I take, but still same error:
Run flutter clean
Run flutter build ios
Follow steps for pod update from this post: https://stackoverflow.com/a/59073131/2162226
Full error output:
Running pod install... 20.8s
Running Xcode build...
(This is taking an unexpectedly lon
Xcode build done. 346.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/gene/git/flutter_wifi/ios/Pods/BoringSSL-GRPC/src/ssl/t1_lib.cc:3319:9: error: use of undeclared identifier
'SSL_get_secure_renegotiation_support'; did you mean 'GRPC_SHADOW_SSL_get_secure_renegotiation_support'?
!(SSL_get_secure_renegotiation_support(ssl) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GRPC_SHADOW_SSL_get_secure_renegotiation_support
In file included from /Users/gene/git/flutter_wifi/ios/Pods/BoringSSL-GRPC/src/ssl/t1_lib.cc:109:
/Users/gene/git/flutter_wifi/ios/Pods/BoringSSL-GRPC/src/include/openssl/ssl.h:4662:5: note: expanded from macro
'SSL_get_secure_renegotiation_support'
SSL_get_secure_renegotiation_support
^
/Users/gene/git/flutter_wifi/ios/Pods/BoringSSL-GRPC/src/include/openssl/ssl.h:1590:20: note:
'GRPC_SHADOW_SSL_get_secure_renegotiation_support' declared here
OPENSSL_EXPORT int SSL_get_secure_renegotiation_support(const SSL *ssl);
^
In file included from <built-in>:1:
/Users/gene/git/flutter_wifi/ios/Pods/Target Support Files/BoringSSL-GRPC/BoringSSL-GRPC-prefix.pch:2489:46: note:
expanded from macro 'SSL_get_secure_renegotiation_support'
#define SSL_get_secure_renegotiation_support GRPC_SHADOW_SSL_get_secure_renegotiation_support
Run this set of commands, where the pod commands are run from <flutterProject>\ios:
rm -rf ~/Library/Developer/Xcode/DerivedData/
rm -rf ~/Library/Caches/CocoaPods/
pod deintegrate
pod update
Thanks to post: https://stackoverflow.com/a/63997424/2162226
After doing this, then running flutter build ios, the error described in OP does not occur.
The other delta - though not sure if it's relevant, is that these changes are being applied to an SSD drive, upgraded from standard hard drive since OP.
Notice in the screenshot, the pod updates includes this line Installing BoringSSL-GRPC (0.0.7) , which I wonder if that's what in fact resolves the issue.
temporarily you can comment below lines in: ios/Pods/BoringSSL-GRPC/src/include/openssl/ssl.h
// #define SSL_CTX_set_tlsext_servername_callback \
SSL_CTX_set_tlsext_servername_callback
// #define SSL_get_secure_renegotiation_support \
SSL_get_secure_renegotiation_support
and rebuild it should work. It appears to be the firebase problem but I haven't found a permanent solution yet...
UPDATE Regarding Work-Around Solution
I am running the builds on a Mac Mini that can take up to 10 minutes to complete a build for the code at hand. When I run flutter clean, it regenerates the ssl.h file and so those 2 lines need to be commented out again.
Having a "smart" text editor open to the code, where the text-editor shows you when the file system has changed (eg, Sublime), I can see that those lines are not commented once flutter build ios gets going. Soon as I see that, I can comment out the lines once again and apparently if I do so in time the build will complete successfully. Before I was letting the build fail after every flutter clean, and then commenting out those lines. It really compounds the build time, so this additional consideration helps in working with the issue here.

Fix errors related to platform_strong.dill

I did flutter build iOS and I'm getting these 3 errors all related to the platform_strong.dill file:
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
Building AOT snapshot in release mode (ios-release)...
Compiler message:
Error: SDK summary not found:
file:///Users/[myusername]/Documents/Documents/development/flutter/bin/ca
che/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill
.
Error: Error when reading
'file:///Users/[myusername]/Documents/Documents/development/flutter/bin/c
ache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dil
l': No such file or directory
Error: Error when reading
'file:///Users/[myusername]/Documents/Documents/development/flutter/bin/c
ache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dil
l': No such file or directory
It says that the file is not there, but it is:
Has anyone else experienced these errors? How would I go about fixing them? I have the latest flutter and I have Xcode 10.3.
Removing the cache folder worked! rm -fr flutter/bin/cache. Then I ran flutter build iOS and all the errors related to the platform_strong.dill went away.

Resources