Hi, i have a KMM library which uses cocoapods for ...
# getting-started
a
Hi, i have a KMM library which uses cocoapods for the ios targets (arm64, simarm64) and when trying to compile its failing because of Unresolved reference: cocoapods BUT when i set one ios target, then it seems to work, but obviously i need to support multiple targets.
Copy code
iosSimulatorArm64 {
    binaries.framework {
        baseName = frameworkName
        xcf.add(this)
    }
}
iosArm64("ios") {
    binaries.framework {
        baseName = frameworkName
        xcf.add(this)
    }
}
cocoapods {
    ios.deploymentTarget = "10.0"
    summary = "Some description for a Kotlin/Native module"
    homepage = "Link to a Kotlin/Native module homepage"

    pod("Analytics") {
        version = "~> 4.1.6"
        moduleName = "Segment"
        source = git("<https://github.com/Reedyuk/analytics-ios.git>") {
            branch = "master"
        }
    }
}
v
Hi Andrew, your configuration looks valid. Could you please share the output of
./gradlew clean assemble --info
a
sure, doing it now, one moment
test.log
v
Probably the log is not complete but I don’t see any failures. Did assemble task finish successfully?
a
odd
Copy code
./gradlew clean assemble --info >> test.log
is what i did
when i run in terminal
logend.log
hmm
Copy code
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_SEGAnalytics", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SEGAnalyticsConfiguration", referenced from:
      objc-class-ref in result.o
ld: symbol(s) not found for architecture arm64
Task :linkDebugFrameworkIos in segmenkt Finished
v
ok, i see the error but still dont understand the reason, could you share you build.gradle.kts file?
a
build.gradle.kts
so when i add:
Copy code
kotlin.mpp.enableCInteropCommonization=true
then it 'works' but then when i try to consume my library, it errors
v
Unfortunately I could not reproduce the issue. I set up similar configuration but it compiles and works fine for me. Would it be possible to share entire project (privately if required) for further investigation?
a
yes its possible, but you will need to give me some time to push
pushed to main branch, run publishToMavenLocal
and you should get the same error i am getting
v
looks like i don’t have an access, my gh name is vkormushkin
s
hi @Andrew Reed, ever succeeded to get rid of those
_OBJC_CLASS_$_
?
a
i forked the cocoapod project and made sure it supported the correct architectures