Hey all . KMM Library via Maven: iOS Build Fails w...
# multiplatform
g
Hey all . KMM Library via Maven: iOS Build Fails with Undefined Symbols Error, CocoaPods Dependencies Not Linked Correctly I am working on a Kotlin Multiplatform Mobile (KMM) project and created a base component library (
za_kmm_base
) that includes a dependency on an Objective-C library (
za_kmm_oc_lib
) via
cocoapods {}
configuration:
Copy code
kotlin
Copy code
cocoapods {
    version = "0.0.2"
    summary = "Za KMM Base Component"
    homepage = "xxxxx"
    ios.deploymentTarget = "12.0"
    pod("za_kmm_oc_lib") {
        version = "0.0.4"
        headers = "ZAKMMRSAUtil.h"
    }
    framework {
        baseName = "za_kmm_base"
        isStatic = true
        transitiveExport = true
    }
}
Then, I published
za_kmm_base
to a private Maven repository for use in other KMM projects. In another project, I referenced this library via Maven:
Copy code
kotlin
Copy code
implementation("com.za.group:za_kmm_base:0.0.2")
However, during the iOS build process, I encountered the following link error:
Copy code
php
Copy code
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_ZAKMMRSAUtil", referenced from:
      in libza_kmm_base.a
ld: symbol(s) not found for architecture arm64
🔍 What I Have Tried: • Ensured that • za`_kmm_oc_lib` • is correctly published via CocoaPods and is working properly in the original KMM module. • In the Maven-based project, I • did not configure
cocoapods {}
or declare the
pod("za_kmm_oc_lib")
again. • Checked Kotlin documentation and found no clear guidance on CocoaPods dependency propagation when KMM libraries are referenced via Maven. Key Problem Points: > Kotlin Multiplatform does not automatically propagate CocoaPods
pod()
dependencies
when KMM libraries are published via Maven. As a result, symbols defined in Objective-C or Swift code (like
ZAKMMRSAUtil
) cannot be linked in the final project, causing the build to fail. 💡 What I Would Like to Confirm: • Is there an official recommended approach to propagate CocoaPods dependencies for KMM libraries published via Maven?Do I need to manually declare
pod("za_kmm_oc_lib")
in every downstream project to correctly link the dependencies?
Is there any plan in Kotlin Multiplatform to support the propagation of CocoaPods dependencies (transitive pod dependencies)?
a
Hi, can you provide a minimal reproducer project?