Diego
02/14/2019, 4:59 PM./gradlew clean build I got the following error:
> Task :common:linkTestDebugExecutableIOS
ld: framework not found MyUtils
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Here is the iOS part of my build.gradle file:
kotlin {
targets {
fromPreset(presets.iosArm32, 'iOS') {
def frameworksDir = "${projectDir}/Frameworks"
binaries {
framework("p2p_common") {
linkerOpts "-F${frameworksDir}"
}
}
compilations.main.extraOpts '-Xembed-bitcode-marker'
compilations.main.cinterops {
MyUtils {
defFile "src/iOSMain/c_interop/MyUtilsFramework.def"
packageName "com.acme.utils"
includeDirs "${frameworksDir}/MyUtils.framework/Headers"
}
}
}
fromPreset(presets.android, 'android')
}
...
MyUtilsFramework.def
language = Objective-C
headers = MyUtils-Swift.h
compilerOpts = -framework MyUtils
linkerOpts = -framework MyUtils
excludeDependentModules = true
I can see the p2p-common-cinterop-MyUtils.klib is generated and actually I can see the classes of the framework from the kotlin code inside the folder iOSMain but as I said before the build fails.
Has anyone a clue why this happens and how I can fix this problem?Dominaezzz
02/14/2019, 5:23 PMlinkerOpts "-F${frameworksDir}" to the compilations.test {} block.Dominaezzz
02/14/2019, 5:24 PMcompilations.test.linkerOpts "-F${frameworksDir}".Dominaezzz
02/14/2019, 5:26 PMlinkerOpts in gradle, they don't get added to the klib, it's only used for "compilation". So all the users of your klib would have to redeclare the linkerOpts in their target compilations.Diego
02/14/2019, 5:42 PMcompilations.test.linkerOpts "-F${frameworksDir}" it works. Thanks a lot @Dominaezzz 🤜🤛