Does kRPC support the last version of Kotlin (<Kot...
# kotlinx-rpc
d
Does kRPC support the last version of Kotlin (Kotlin 2.3.21) ?
Something is blocking creating an artifact for 2.3.21 ?
@Alexander Sysoev could you please create an artifact for 2.3.21 ?
g
Seem to work with 2.3.10 https://github.com/Kotlin/kotlinx-rpc/blob/release-0.11.0-grpc-188/samples/grpc-kmp-app/gradle/libs.versions.toml No trouble detected in 2.3.20, but ko with 2.3 .21 for me
j
The latest non-grpc version (0.10.2) works just fine with kotlin 2.3.21
a
It works, artifacts are published We usually backport support as soon as the version is out. I forgot to update docs though, thanks for poiting it out
d
Okay thanks, waiting for an artifact for Kotlin 2.4.0-RC2 soon an well 🫠
a
It is already there
d
I do not know if it's just for me but in Kotlin 2.4.0-RC2 kotlinx-rpc = "0.10.2", the release variant specifically does not work linkReleaseFrameworkIosArm64, something along the log lines:
at org.jetbrains.kotlin.backend.konan.driver.phases.LTOKt.BuildDFGPhase$lambda$1(LTO.kt:40)
a
Can you give a reproducer, please?
d
It would be problematic, I have these logs:
Copy code
> Task :app:shared:linkReleaseFrameworkIosArm64 FAILED
error: Compilation failed: Internal compiler error: no implementation found for FUN DEFAULT_PROPERTY_ACCESSOR name:<get-callables> visibility:public modality:ABSTRACT <> (<this>:kotlinx.rpc.descriptor.RpcServiceDescriptor<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>) returnType:kotlin.collections.Map<kotlin.String, kotlinx.rpc.descriptor.RpcCallable<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>>
when building itable for CLASS INTERFACE name:RpcServiceDescriptor modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
implementation in CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<com.mafrend.application.services.ChatService>]
at /Users/dest/Documents/Mafrend/core/src/commonMain/kotlin/com/mafrend/application/services/ChatService.kt (8:1)
CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<com.mafrend.application.services.ChatService>]

 * Compiler version: 2.4.0-RC2
Compilation failed: Internal compiler error: no implementation found for FUN DEFAULT_PROPERTY_ACCESSOR name:<get-callables> visibility:public modality:ABSTRACT <> (<this>:kotlinx.rpc.descriptor.RpcServiceDescriptor<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>) returnType:kotlin.collections.Map<kotlin.String, kotlinx.rpc.descriptor.RpcCallable<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>>

 * Output kind: FRAMEWORK

error: java.lang.IllegalStateException: Internal compiler error: no implementation found for FUN DEFAULT_PROPERTY_ACCESSOR name:<get-callables> visibility:public modality:ABSTRACT <> (<this>:kotlinx.rpc.descriptor.RpcServiceDescriptor<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>) returnType:kotlin.collections.Map<kotlin.String, kotlinx.rpc.descriptor.RpcCallable<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>>
when building itable for CLASS INTERFACE name:RpcServiceDescriptor modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
java.lang.IllegalStateException: Internal compiler error: no implementation found for FUN DEFAULT_PROPERTY_ACCESSOR name:<get-callables> visibility:public modality:ABSTRACT <> (<this>:kotlinx.rpc.descriptor.RpcServiceDescriptor<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>) returnType:kotlin.collections.Map<kotlin.String, kotlinx.rpc.descriptor.RpcCallable<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>>

implementation in CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<com.mafrend.application.services.ChatService>]
at /Users/dest/Documents/Mafrend/core/src/commonMain/kotlin/com/mafrend/application/services/ChatService.kt (8:1)
CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<com.mafrend.application.services.ChatService>]
	at org.jetbrains.kotlin.backend.konan.ReportingKt.error(Reporting.kt:43)
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapClassReferenceType(DataFlowIR.kt:561)
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapType(DataFlowIR.kt:606)
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapTypeToFunctionParameter(DataFlowIR.kt:612)
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapFunction(DataFlowIR.kt:676)
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapFunction(DataFlowIR.kt:617)
	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$computeRootSet$1.visitClass(DevirtualizationAnalysis.kt:109)
	at org.jetbrains.kotlin.ir.visitors.IrVisitorVoid.visitClass(IrVisitorVoid.kt:44)
	at org.jetbrains.kotlin.ir.visitors.IrVisitorVoid.visitClass(IrVisitorVoid.kt:18)
	at org.jetbrains.kotlin.ir.declarations.IrClass.accept(IrClass.kt:72)
	at org.jetbrains.kotlin.ir.declarations.IrPackageFragment.acceptChildren(IrPackageFragment.kt:27)
	at org.jetbrains.kotlin.ir.visitors.IrVisitorsKt.acceptChildrenVoid(IrVisitors.kt:23)
	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$computeRootSet$1.visitElement(DevirtualizationAnalysis.kt:101)
	at org.jetbrains.kotlin.ir.visitors.IrVisitorVoid.visitPackageFragment(IrVisitorVoid.kt:168)
Task appshared:linkReleaseFrameworkIosArm64 FAILED
Task appshared:linkDebugFrameworkIosArm64 // SUCCESS
My Agent tells me that this could be the problem:
Copy code
KRPC-560: kotlinx-rpc compiler plugin generates a Companion object
// for RpcServiceDescriptor whose `callables` property has no itable implementation,
// causing an ICE in the Kotlin/Native BuildDFG + DevirtualizationAnalysis phases.
it would be nice if I would understand it
I have this simple interface if that helps:
Copy code
@Rpc
@Deprecated("...")
interface ChatService {
    suspend fun deleteMessage(messageId: Long): Boolean?
    suspend fun editMessage(request: EditMessageRequest): Boolean?
    suspend fun getChatParticipants(featureId: Long): List<ChatParticipantData>?
    suspend fun leavePoiChat(featureId: Long?, userId: String?): Boolean?
    suspend fun joinPoiChat(request: JoinChatRequest): Long?
    suspend fun getPoiMessages(featureId: Long, limit: Int, offset: Long): List<ChatMessageData>
    suspend fun sendMessage(request: SendMessageRequest): Long?
    suspend fun getUserChats(userId: String): List<ChatSummary>
}
a
Alright, thanks! I'll take a look, but next week I'm on vacation, so it might take a while
d
You need to hire a junior developer to help you 😊
😅 1
I hope you had a good vacation! 🙂 Now I'm waiting for the new version with Kotlin 2.4.0 (RC) support and with this fixed bug: on Task appshared:linkReleaseFrameworkIosSimulatorArm64 and Task appshared:linkReleaseFrameworkIosArm64
Copy code
java.lang.IllegalStateException: Internal compiler error: no implementation found for FUN DEFAULT_PROPERTY_ACCESSOR name:<get-callables> visibility:public modality:ABSTRACT <> (<this>:kotlinx.rpc.descriptor.RpcServiceDescriptor<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>) returnType:kotlin.collections.Map<kotlin.String, kotlinx.rpc.descriptor.RpcCallable<T of kotlinx.rpc.descriptor.RpcServiceDescriptor>>
when building itable for CLASS INTERFACE name:RpcServiceDescriptor modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
implementation in CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<A RPC INTERFACE>]
debug linking task works fine for a reason
Also I have a hack workaround in the project for a reason (could not remember what exactly did not work):
Copy code
// Workaround: kotlinx-rpc compiler plugin generates code that crashes
// the Kotlin/Native DevirtualizationAnalysis phase (itable for RpcServiceDescriptor).
// Disable it until kotlinx-rpc fixes the issue for Kotlin 2.4.0.
iosTarget.binaries.all {
    if (buildType == org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE) {
        freeCompilerArgs = freeCompilerArgs + "-Xdisable-phases=DevirtualizationAnalysis"
    }
}
e
Hi! We found the problem regarding this (it was already fixed on the main branch). The fix will be released in 0.10.3 😊
🔥 1