Hi! trying to update my KMM project to latest kotl...
# k2-adopters
g
Hi! trying to update my KMM project to latest kotlin 2.0.0 and faced issue while building shared lib for ios using task
buildXCFramework
(
assembleXCFramework
):
Copy code
> Task :shared:linkReleaseFrameworkIos
w: Cannot infer a bundle ID from packages of source files and exported dependencies, use the bundle name instead: shared. Please specify the bundle ID explicitly using the -Xbinary=bundleId=<id> compiler flag.
w: -memory-model and memoryModel switches are deprecated and will be removed in a future release.
w: freezing switch is deprecated and will be removed in a future release.
e: Compilation failed: class org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl cannot be cast to class org.jetbrains.kotlin.ir.declarations.IrClass (org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl and org.jetbrains.kotlin.ir.declarations.IrClass are in unnamed module of loader java.net.URLClassLoader @5fb41bd3)

 * Source files: 
 * Compiler version: 2.0.0
 * Output kind: FRAMEWORK

e: java.lang.ClassCastException: class org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl cannot be cast to class org.jetbrains.kotlin.ir.declarations.IrClass (org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl and org.jetbrains.kotlin.ir.declarations.IrClass are in unnamed module of loader java.net.URLClassLoader @5fb41bd3)
	at org.jetbrains.kotlin.ir.util.AdditionalIrUtilsKt.getConstructedClass(AdditionalIrUtils.kt:20)
	at org.jetbrains.kotlin.backend.common.serialization.mangle.ir.IrExportCheckerVisitor$CompatibleChecker.visitConstructor(IrExportCheckerVisitor.kt:128)
	at org.jetbrains.kotlin.backend.common.serialization.mangle.ir.IrExportCheckerVisitor$CompatibleChecker.visitConstructor(IrExportCheckerVisitor.kt:87)
	at org.jetbrains.kotlin.ir.declarations.IrConstructor.accept(IrConstructor.kt:28)
	at org.jetbrains.kotlin.backend.common.serialization.mangle.ir.IrExportCheckerVisitor.check(IrExportCheckerVisitor.kt:33)
	at org.jetbrains.kotlin.backend.konan.llvm.KonanBinaryInterface.isExported(BinaryInterface.kt:62)
	at org.jetbrains.kotlin.backend.konan.llvm.KonanBinaryInterface.getSymbolName(BinaryInterface.kt:48)
	at org.jetbrains.kotlin.backend.konan.llvm.BinaryInterfaceKt.computeSymbolName(BinaryInterface.kt:136)
	at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.generateObjCImp(ObjCExportCodeGenerator.kt:938)
lib versions: koltin:2.0.0 gradle:8.5 (happened on 8.4 as well) java:21 (happened on 17 as well) coroutines: 1.8.1 serialization: 1.7.0-RC Any further info needed? or maybe a direction where to look possible problem Thanks 🙏
t
could you open a Kotlin issue with repro?
g
i guess i'll have to 😄 i'll try to do the repro during next days
so, i've created sample project without logic but with all libraries i use and same modules structure etc. and it builds ok there 😄 so the problem is somewhere between my company's classes . Is there a way to identify better at which phase f.ex or during compilation of which class exactly this happened "java.lang.ClassCastException: class org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl cannot be cast to class org.jetbrains.kotlin.ir.declarations.IrClass (org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl and org.jetbrains.kotlin.ir.declarations.IrClass are in unnamed module of loader java.net.URLClassLoader @5fb41bd3)" ?
t
There is similar issue, but it is about JVM backend and according to your stacktrace it is more about Native part but it was for JVM backend and your stacktrace is about Kotlin Native Objective C export. I will try to ping someone from Native team tomorrow about this issue.
🙏 1
g
btw adding arguments as your colleague wrote: "As a workaround, you can use this compiler argument: `-Xdisable-phases=PropertyReferenceDelegation`" - didn't helped, it only exceeded build time
t
@svyatoslav.scherbina could you help here?
🙌 1
s
Please create a new issue: https://kotl.in/issue. A reproducer is essential.
g