Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Error when updating to 3.1.0 (PageScrollAnimation) #727

Closed
oblakr24 opened this issue Jun 15, 2024 · 11 comments
Closed

iOS: Error when updating to 3.1.0 (PageScrollAnimation) #727

oblakr24 opened this issue Jun 15, 2024 · 11 comments
Labels
bug Something isn't working not decompose Something unrelated to Decompose

Comments

@oblakr24
Copy link

I have a KMP project (Kotlin 2.0.0) with an iOS target.
Updating from 3.0.0 to 3.1.0 (Essenty at 2.0.0) works fine on Android and Desktop, but on iOS I get the following build failure:

error: org.jetbrains.kotlin.backend.konan.llvm.NativeCodeGeneratorException: Exception during generating code for following declaration:
Inside: FILE fqName:feature.main fileName:/Users/rokoblak/Projects/PersonaLLM/composeApp/src/commonMain/kotlin/feature/main/MainScreen.kt

This is a composable in my app which is a page in a pager.

Pages(
            pages = component.pages,
            onPageSelected = component::selectPage,
            modifier = Modifier.padding(padding).fillMaxSize(),
           scrollAnimation = PagesScrollAnimation.Default,

and is specifically related to this line:
scrollAnimation = PagesScrollAnimation.Default,
commenting out this line solves the issue.

The root stacktrace below:

Caused by: java.lang.IllegalStateException: FIELD name:com_arkivanov_decompose_extensions_compose_pages_PagesScrollAnimation_Default$stable type:kotlin.Int visibility:public [final,static]
	at org.jetbrains.kotlin.backend.konan.llvm.LlvmDeclarations.forStaticField(LlvmDeclarations.kt:53)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.staticFieldPtr(IrToBitcode.kt:1871)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateGetField(IrToBitcode.kt:1767)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:983)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression$default(IrToBitcode.kt:971)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExplicitArgs(IrToBitcode.kt:2366)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateCall(IrToBitcode.kt:2237)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:975)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression$default(IrToBitcode.kt:971)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExplicitArgs(IrToBitcode.kt:2366)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateCall(IrToBitcode.kt:2237)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:975)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression$default(IrToBitcode.kt:971)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExplicitArgs(IrToBitcode.kt:2366)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateCall(IrToBitcode.kt:2237)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:975)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateContainerExpression(IrToBitcode.kt:2215)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:991)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.generateWhenCase(IrToBitcode.kt:1346)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateWhen(IrToBitcode.kt:1314)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression(IrToBitcode.kt:987)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.evaluateExpression$default(IrToBitcode.kt:971)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.generateStatement(IrToBitcode.kt:1012)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.generateStatement$default(IrToBitcode.kt:1010)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitFunction(IrToBitcode.kt:888)
	at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitSimpleFunction(IrElementVisitorVoid.kt:144)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitSimpleFunction(IrToBitcode.kt:244)
	at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitSimpleFunction(IrElementVisitorVoid.kt:140)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitSimpleFunction(IrToBitcode.kt:244)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitSimpleFunction(IrToBitcode.kt:244)
	at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:36)
	at org.jetbrains.kotlin.ir.declarations.IrFile.acceptChildren(IrFile.kt:34)
	at org.jetbrains.kotlin.ir.visitors.IrVisitorsKt.acceptChildrenVoid(IrVisitors.kt:15)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitFile$lambda$41$lambda$40(IrToBitcode.kt:606)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.runAndProcessInitializers(IrToBitcode.kt:455)
	at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitFile(IrToBitcode.kt:605)
	... 188 more

error: Compilation finished with errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':composeApp:linkDebugFrameworkIosSimulatorArm64'.
> Compilation finished with errors

Please let me know if I can provide any further info.

@arkivanov
Copy link
Owner

What compose version are you using? Could you please try using Essenty 2.1.0 and Compose 1.6.10?

@oblakr24
Copy link
Author

@arkivanov yep I used Essenty 2.1.0 (just tried with 2.0.0 to ensure which version bump was related to the issue).

I am using 1.6.11:

compose-plugin = "1.6.11"
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }

@arkivanov
Copy link
Owner

Would it be possible to provide a reproducer?

@arkivanov
Copy link
Owner

arkivanov commented Jun 15, 2024

This looks like a compiler bug.

@oblakr24
Copy link
Author

I have the app here:
https://github.com/oblakr24/personallm

I am assuming the minimal reproducible scenario would be a Pager with this animation, but haven't set that up to validate.

But yes, it does seem like a compiler bug.
Perhaps related (but closed?):
JetBrains/compose-multiplatform#4809

@arkivanov
Copy link
Owner

That issue looks related, thanks! I would check a reproducer and report a bug to Compose, if you could provide a link to a runnable project with the failing changes.

@oblakr24
Copy link
Author

I pushed the bump here:
https://github.com/oblakr24/personallm/tree/feature/decompose-to-3.1.0
the project should be runnable (no other setup needed).
I can try setting up a smaller project later (not today) with min repro scenario.

@arkivanov
Copy link
Owner

Thanks! I managed to create a minimal reproducer. Reported here: JetBrains/compose-multiplatform#4809 (comment)

Let's keep this bug open for visibility purposes.

@arkivanov arkivanov added bug Something isn't working not decompose Something unrelated to Decompose labels Jun 15, 2024
@arkivanov
Copy link
Owner

The suggested workaround works. Add the following lines to gradle.properties.

kotlin.native.cacheKind=none
compose.kotlin.native.manageCacheKind=false

@oblakr24
Copy link
Author

Great, thank you, the workaround works for me too. But yes let's keep it open until the related CMP issue is resolved.

@arkivanov
Copy link
Owner

Looks like this issue should be fixed in Kotlin 2.0.10, the fix is already available in Kotlin 2.0.10-RC2. See JetBrains/compose-multiplatform#4809 (comment). Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not decompose Something unrelated to Decompose
Projects
None yet
Development

No branches or pull requests

2 participants