Travis Reitter
01/19/2022, 10:48 PMembedAndSignAppleFrameworkForXcode
to build my iOS app (Kotlin 1.6.10, M1 Mac, Xcode 13.2.1) and I hit this crash at runtime which seems to indicate a linking error but I'm not sure why since I include this in my Frameworks search paths:
$(SRCROOT)/../SharedCode/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)
The error is:
dyld[28834]: Library not loaded: @rpath/SharedCode.framework/SharedCode
Referenced from: /Users/treitter/Library/Developer/CoreSimulator/Devices/A5638492-9E3A-4766-B4D4-6827DF4DBAC8/data/Containers/Bundle/Application/CADE4DEF-489A-4E7F-B600-8CFAA803F19D/DoubleStrain <http://dev.app/DoubleStrain|dev.app/DoubleStrain> dev
Reason: tried: '/Users/treitter/Library/Developer/Xcode/DerivedData/DoubleStrain-csfvqjqyopvjufbkvgenmyhjexpz/Build/Products/Debug-iphonesimulator/SharedCode.framework/SharedCode' (no such file), '/Users/treitter/Library/Developer/Xcode/DerivedData/DoubleStrain-csfvqjqyopvjufbkvgenmyhjexpz/Build/Products/Debug-iphonesimulator/PackageFrameworks/SharedCode.framework/SharedCode' (no such file),
...
it continues on with many more directories it checked but none of them match the pattern above. None even include xcode-frameworks
in the path.
Any ideas for debugging?Dmitry Motyl
05/12/2022, 10:55 AMTravis Reitter
05/13/2022, 4:07 PMbuild.gradle.kts
for my KMM project (see the functions at the top):
kotlin {
android {
publishAllLibraryVariants()
}
fun isIphoneSimulatorBuild(): Boolean =
System.getenv("NATIVE_ARCH") == "arm64" && System.getenv("SDK_NAME")?.startsWith("iphonesimulator") == true
fun isIphoneOsBuild(): Boolean =
System.getenv("SDK_NAME")?.startsWith("iphoneos") == true
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
when {
isIphoneSimulatorBuild() -> ::iosSimulatorArm64
isIphoneOsBuild() -> ::iosArm64
else -> ::iosX64
}
iosTarget("ios") {
val sdkName = when {
isIphoneSimulatorBuild() -> "iphonesimulator"
isIphoneOsBuild() -> "iphoneos"
else -> "x86"
}
binaries {
framework {
baseName = "shared"
}
...
}
}