Different issue: when trying to export multiple mo...
# swift-export
m
Different issue: when trying to export multiple modules with Swift Export in Kotlin 2.4.0, I get an error
e: Compilation failed: Global 'ktypew:kotlin.collections.MutableList' already exists
. It seems we're not using
MutableList
directly. I've found a
MutableList
usage in Koin, which we're using. And Koin has a
ParametersHolder
, which uses
MutableList
in a parameter. This issue mentions to replace usages of lists by
List
for the Swift Export to work - is that true? How would we best handle this usecase, ideally by not having to move away from the libraries we currently use?
More of the stacktrace:
Copy code
> Task :umbrella:linkSwiftExportBinaryDebugStaticIosSimulatorArm64 FAILED
e: Compilation failed: Global 'ktypew:kotlin.collections.MutableList' already exists

 * Compiler version: 2.4.0
 * Output kind: STATIC

e: java.lang.IllegalArgumentException: Global 'ktypew:kotlin.collections.MutableList' already exists
	at org.jetbrains.kotlin.backend.konan.llvm.StaticData$Global$Companion.createLlvmGlobal(StaticData.kt:28)
	at org.jetbrains.kotlin.backend.konan.llvm.StaticData$Global$Companion.create(StaticData.kt:47)
	at org.jetbrains.kotlin.backend.konan.llvm.StaticData.createGlobal(StaticData.kt:110)
	at org.jetbrains.kotlin.backend.konan.llvm.StaticData.placeGlobal(StaticData.kt:117)
	at org.jetbrains.kotlin.backend.konan.llvm.LlvmUtilsKt.replaceExternalWeakOrCommonGlobal(LlvmUtils.kt:178)
	at org.jetbrains.kotlin.backend.konan.llvm.LlvmUtilsKt.replaceExternalWeakOrCommonGlobal(LlvmUtils.kt:195)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.WritableTypeInfoKt.setWritableTypeInfo(WritableTypeInfo.kt:115)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.WritableTypeInfoKt.bindObjCExportConvertToRetained(WritableTypeInfo.kt:85)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.bindObjCExportConvertToRetained(ObjCExportCodeGenerator.kt:1922)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.emitCollectionConverters(ObjCExportCodeGenerator.kt:723)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.emitSpecialClassesConvertions(ObjCExportCodeGenerator.kt:708)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.access$emitSpecialClassesConvertions(ObjCExportCodeGenerator.kt:1)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGenerator.generate$org_jetbrains_kotlin_backend_native(ObjCExportCodeGenerator.kt:437)
	at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport.generate$org_jetbrains_kotlin_backend_native(ObjCExport.kt:203)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment$lambda$1(IrToBitcode.kt:417)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.runAndProcessInitializers(IrToBitcode.kt:393)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:415)
a
I would argue, that Koin should not be a part of your public API and should be an implementation detail from the point view of iOS application? Or do you have some swift code calling Koin? If so - do you have an example of such code?
m
Yes, I'd argue the same. However, coming from the old XCframework world over to the new shiny Swift Export world, many things that worked before will stop working. So maybe the answer is: the migration will just take a lot of work.
I'll see what I can do about this. I hoped I could just enable Swift Export and start using it, but the process is more complicated than I expected.