Working in Kotlin Multiplatform project with Cocoapods dependency.
These are the build output log
Ld
/Users/andrea/Folders/KMP/ComposeWeather/build/ios/Debug-iphonesimulator/ComposeWeather.app/ComposeWeather
normal (in target ‘iosApp’ from project ‘iosApp’)
cd /Users/andrea/Folders/KMP/ComposeWeather/iosApp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-Xlinker -reproducible -target x86_64-apple-ios14.1-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk
-O0 -L/Users/andrea/Folders/KMP/ComposeWeather/build/ios/EagerLinkingTBDs/Debug-iphonesimulator
-L/Users/andrea/Folders/KMP/ComposeWeather/build/ios/Debug-iphonesimulator
-F/Users/andrea/Folders/KMP/ComposeWeather/build/ios/EagerLinkingTBDs/Debug-iphonesimulator
-F/Users/andrea/Folders/KMP/ComposeWeather/build/ios/Debug-iphonesimulator
-F/Users/andrea/Folders/KMP/ComposeWeather/iosApp/../shared/build/xcode-frameworks/Debug/iphonesimulator17.2
-F/Users/andrea/Folders/KMP/ComposeWeather/iosApp/../composeApp/build/xcode-frameworks/Debug/iphonesimulator17.2
-filelist /Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/x86_64/ComposeWeather.LinkFileList
-Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker
@loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker
/Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/x86_64/ComposeWeather_lto.o
-Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
-L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/x86_64/ComposeWeather.swiftmodule
-ObjC -lc++ -framework composeApp -framework composeApp -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/ComposeWeather.app-Simulated.xcent
-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __ents_der -Xlinker /Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/ComposeWeather.app-Simulated.xcent.der
-framework Pods_iosApp -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/andrea/Folders/KMP/ComposeWeather/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/x86_64/ComposeWeather_dependency_info.dat
-o /Users/andrea/Folders/KMP/ComposeWeather/build/ios/Debug-iphonesimulator/ComposeWeather.app/ComposeWeatherld: warning: search path
‘/Users/andrea/Folders/KMP/ComposeWeather/iosApp/../shared/build/xcode-frameworks/Debug/iphonesimulator17.2’
not foundld: framework ‘Pods_iosApp’ not found clang: error: linker command
failed with exit code 1 (use -v to see invocation)** BUILD FAILED **
The following build commands failed:
Ld
/Users/andrea/Folders/KMP/ComposeWeather/build/ios/Debug-iphonesimulator/ComposeWeather.app/ComposeWeather
normal (in target ‘iosApp’ from project ‘iosApp’)(1 failure) warning: Run script build phase ‘Compile Kotlin Framework’
will be run during every build because it does not specify any
outputs. To address this warning, either add output dependencies to
the script phase, or configure it to run in every build by unchecking
"Based on dependency analysis" in the script phase. (in target
‘iosApp’ from project ‘iosApp’)
The Cocoapods scripts in build.gradle.kts
cocoapods {
version = "1.0.0"
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "16.0"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "composeApp"
isStatic = true
}
// Maps custom Xcode configuration to NativeBuildType
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
}
Appreciate if there is any help or clue, how I can solve this.
Note : it works fine for Android simulator
2
Answers
Well the error here:
‘/Users/andrea/Folders/KMP/ComposeWeather/iosApp/../shared/build/xcode-frameworks/Debug/iphonesimulator17.2’ not found
Can you check if you have the simulator device installed (the target device you are deploying to)?
And can you also check if you have iOSX64 target set properly on your shared module’s gradle file?
You should have something like this:
With x64 devices you should only be able to target rosetta simulators.
For example: iPhone 14 (Rosetta).
With simulatorArm64 you should be able to target non rosetta
In the
cocoapods {
block try