Errors in creating XCFramework using Cocoapods - ios

I am trying to generate a iOS XCFramework from an Xcode framework Project(Project name XCFramework). Project consists of some of the cocoa-pods libraries like Socket IO, SwiftKeyChainWrapper etc. If I generate XCFramework without cocoa-pods, xcodebuild commands are generating the XCFramework successfully for both iOS and iOS Simulator destinations, but when I install pods in the framework project I am getting many errors. It will be really helpful if any one has come across this scenario and succeeded kindly help in generating XCFramework sample project using cocoa-pods.
Note: a) I used a small package called xcframework which generates xcfremwork in command (1)
b) If I archive the project directly from Xcode the archive gets successful.
1) Buid command:- xcframework build --project XCFramework.xcodeproj --name XCFramework --iOS EcallXCFramework
......
......
** ARCHIVE FAILED **
The following build commands failed:
Ld /Users/*******/Library/Developer/Xcode/DerivedData/XCFramework-gccrcnyzlsezmugkrqqlnpusjfci/Build/Intermediates.noindex/ArchiveIntermediates/XCFramework/InstallationBuildProductsLocation/Library/Frameworks/XCFramework.framework/XCFramework normal arm64
(1 failure)
2) Build Command:- xcodebuild archive -scheme XCFramework -destination="generic/platform=iOS" -destination="generic/platform=iOS Simulator" SKIP_INSTALL=NO
......
.......
User defaults from command line:
destination = generic/platform=iOS Simulator
Build settings from command line:
SKIP_INSTALL = NO
xcodebuild: error: Failed to build project EcallXCFramework with scheme XCFramework.
Reason: The run destination My Mac is not valid for Archiving the scheme 'XCFramework'.
3) Build Command:- xcodebuild archive
.....
.....
ld: framework not found SwiftKeychainWrapper
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** ARCHIVE FAILED **
The following build commands failed:
Ld /tmp/EcallXCFramework.dst/Library/Frameworks/EcallXCFramework.framework/EcallXCFramework normal arm64
(1 failure)

Related

Flutter iOS error "ld: framework not found installDir"

I am a flutter newbie and I get this error when trying to run/build for iOS. I tried to clean Xcode, clean flutter, remove flutter, remove iOS folder, remove and re-download Xcode, but still.
No difference when trying to build from Xcode or vscode terminal.
what gets logged :
Launching lib/main.dart on iPhone 11 in debug mode...
Running Xcode build...
Xcode build done. 7.3s
Failed to build iOS app
Error output from Xcode build:
↳
2022-07-28 17:04:40.105 xcodebuild[34247:421486] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
com.apple.dt.IDEWatchSupportCore
2022-07-28 17:04:40.105 xcodebuild[34247:421486] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/sy/mftlbsd5489gl3102v5z7fwm0000gp/T/flutter_tools.RmfxI1/flutter_ios_build_temp_dirho9O3B/temporary_xcresult_bundle
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
ld: framework not found installDir
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/sy/mftlbsd5489gl3102v5z7fwm0000gp/T/flutter_tools.RmfxI1/flutter_ios_build_temp_dirho9O3B/temporary_xcresult_bundle
Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code
Error (Xcode): Framework not found installDir
Could not build the application for the simulator.
Error launching application on iPhone 11.
Try to do this:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
I checked my notes and found similar case in my experience.
Try to run these commands twice:
xcrun -sdk iphoneos --show-sdk-path
xcrun -sdk iphoneos --show-sdk-version
xcrun -sdk iphoneos --show-sdk-build-version
xcrun -sdk iphoneos --show-sdk-platform-path
xcrun -sdk iphoneos --show-sdk-platform-version
First run I got error, next time it works.

error: using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code

I have switched to Xcode12 for one of my static library apps. I am trying to make XCFramework distribution. After running build command,
xcodebuild archive -scheme "MySDK" -sdk iphoneos -archivePath “./archives/ios.xcarchive” -SKIP_INSTALL=NO
I am getting below error when I switched Build Settings -> Build Libraries for Distribution to YES,
<unknown>:0: error: using bridging headers with module interfaces is unsupported
Command CompileSwiftSources failed with a nonzero exit code
** ARCHIVE FAILED **
The following build commands failed:
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal armv7s com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(3 failures)
This answer works but unfortunately creating .xcframework requires to set the option distribution YES.
How to resolve this issue?
Apple seems to be deprecating bridging headers in favor of modules, but their documentation regarding how to include C headers is missing. The information is instead found in the more detailed clang docs.
Try removing the bridging header from the project settings and instead create a module.modulemap file:
module MySdk {
header "MySdk-Bridging-Header.h"
export *
}
This has caveats, such as needing to import MySdk in your swift code and understanding that C functions will be exposed, but it got me over the hump.
One trick I discovered by trial and error is to include this modulemap file and C headers in the framework's Headers folder. This allows any app consuming the framework to automatically detect MySdk as a module.

use xcodebuild to creat a CI system, error : "Ld build xxxx normal arm64"

Recently I was asked to creat a CI system, so I tride to use xcodebuild.
But I got Errors, the command is :xcodebuild -sdk iphoneos -configuration Release clean build
Errors:
ld: library not found for -lFMDB
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/ProjectName.build/Release-iphoneos/ProjectName.build/Objects-normal/armv7/ProjectName normal armv7
Ld build/ProjectName.build/Release-iphoneos/ProjectName.build/Objects-normal/arm64/ProjectName normal arm64
I import FMDB by cocoa pods, and Header Search Path has this path "${PODS_ROOT}/Headers/Public/FMDB".
Please help me,thx very much.

xcodebuild build failed with Xcode 7.1 and iOS 9.1 for iOS project with Cordova

I am trying to build iOS projects from the command line as part of a CI system. I intend to use the xcodebuild command to get an app file, then the app file will be provided to the xcrun command to get a signed ipa file for distribution.
My projects use Cordova, which is located in the folder <project-folder>/CordovaLib.
In the project folder, I executed the following command from within an Ant script:
xcodebuild -target "<project-name>" -configuration Release clean build
The CordovaLib target was built succesfully, and it was produced the file:
<project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a
This is visible by the following snippet of log:
[exec] CreateUniversalBinary build/Release-iphoneos/libCordova.a
normal armv7\ armv7s\ arm64 [exec] cd <project-folder>/CordovaLib
[exec] export
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/quake/bin:Applications/tools/apache-ant-1.8.4/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin"
[exec]/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-static <project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7/libCordova.a
<project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7s/libCordova.a
<project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/arm64/libCordova.a
-o <project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a
During the build of the target <project-name> I got the following error for three times:
ld: file not found:
/build/Release-iphoneos/libCordova.a clang: error:
linker command failed with exit code 1 (use -v to see invocation)
And finally:
The following build commands failed: Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7/HelloWorld
normal armv7 Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7s/HelloWorld
normal armv7s Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/arm64/HelloWorld
normal arm64 (3 failures)
So the file libCordova.a was produced in the folder:
<project-folder>/CordovaLib/build/Release-iphoneos
and it was searched instead in:
<project-folder>/build/Release-iphoneos
I'm using Xcode Version 7.1 (7B91b) with iOS 9.1.
Should I set something on Xcode in addition to the parameters I have used in the xcodebuild command from the command line?
Thanks in advance, Simone.
My project comes from a MEAP IDE. I discovered that the auto-generated project file project.pbxproj had this setting for the linker:
OTHER_LDFLAGS=-force_load "$(BUILT_PRODUCTS_DIR)/libCordova.a" -Obj-C
Hence I modified this way the xcodebuild command invocation:
xcodebuild -target "<project-name>" -configuration Release clean build 'OTHER_LDFLAGS=-force_load "$SRCROOT/CordovaLib/build/Release-iphoneos/libCordova.a" -Obj-C'
That resolved my problem.

iOS simulator build issue - "library not found"

I need to create simulator build for Facebook review.
I have 2 targets in my project - the app sources & static library.
I have tried the steps described at Facebook tutorial.
I used next command:xcodebuild -arch i386 -sdk iphonesimulator8.1
But build failed with error
"library not found for -lOOyalaAllSources"
and one more
"The following build commands failed:
Ld build/Release-iphonesimulator/MyApp.app/MyApp normal i386"
OOyalaAllSources - the name of static library I used.
How can I fix this issues?

Resources