https://kotlinlang.org logo
Title
a

Andrew Reed

02/12/2022, 10:42 AM
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.
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

Viacheslav Kormushkin

02/14/2022, 8:51 AM
Hi Andrew, your configuration looks valid. Could you please share the output of
./gradlew clean assemble --info
a

Andrew Reed

02/14/2022, 9:19 AM
sure, doing it now, one moment
v

Viacheslav Kormushkin

02/14/2022, 9:42 AM
Probably the log is not complete but I don’t see any failures. Did assemble task finish successfully?
a

Andrew Reed

02/14/2022, 9:46 AM
odd
./gradlew clean assemble --info >> test.log
is what i did
when i run in terminal
hmm
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

Viacheslav Kormushkin

02/14/2022, 11:08 AM
ok, i see the error but still dont understand the reason, could you share you build.gradle.kts file?
a

Andrew Reed

02/14/2022, 11:12 AM
so when i add:
kotlin.mpp.enableCInteropCommonization=true
then it 'works' but then when i try to consume my library, it errors
v

Viacheslav Kormushkin

02/14/2022, 3:32 PM
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

Andrew Reed

02/14/2022, 3:35 PM
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

Viacheslav Kormushkin

02/14/2022, 4:22 PM
looks like i don’t have an access, my gh name is vkormushkin
s

siraf

11/07/2022, 7:15 AM
hi @Andrew Reed, ever succeeded to get rid of those
_OBJC_CLASS_$_
?
a

Andrew Reed

11/07/2022, 7:34 PM
i forked the cocoapod project and made sure it supported the correct architectures