question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to use Compose runtime in common code targeting native

See original GitHub issue

Failing to compile simple Compose function targeting native code (iOS iosX64 or iosArm64).

Kotlin 1.7.10 Jetbrains Compose 1.2.0-beta01 Compose compiler 1.3.0

Repo code is in this branch: https://github.com/kirillzh/kmm-production-sample/tree/common-compose.

// shared/src/commonMain
@Composable
fun Foo() {
}

Error:

> Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED
w: Mimalloc allocator isn't supported on target ios_simulator_arm64. Used standard mode.
e: Compilation failed: No file for com.github.jetbrains.rssreader/Foo|4071909078632269291[0] (@ com.github.jetbrains.rssreader/Foo|4071909078632269291[0]) in module `<RssReader:shared>`[ModuleDescriptorImpl@57d43629]

 * Source files: 
 * Compiler version info: Konan: 1.7.10 / Kotlin: 1.7.20
 * Output kind: FRAMEWORK

e: java.lang.IllegalStateException: No file for com.github.jetbrains.rssreader/Foo|4071909078632269291[0] (@ com.github.jetbrains.rssreader/Foo|4071909078632269291[0]) in module `<RssReader:shared>`[ModuleDescriptorImpl@57d43629]
	at org.jetbrains.kotlin.backend.common.serialization.BasicIrModuleDeserializer.deserializeIrSymbol(BasicIrModuleDeserializer.kt:95)
Full Error
> Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED
w: Mimalloc allocator isn't supported on target ios_simulator_arm64. Used standard mode.
e: Compilation failed: No file for com.github.jetbrains.rssreader/Foo|4071909078632269291[0] (@ com.github.jetbrains.rssreader/Foo|4071909078632269291[0]) in module `<RssReader:shared>`[ModuleDescriptorImpl@57d43629]

 * Source files: 
 * Compiler version info: Konan: 1.7.10 / Kotlin: 1.7.20
 * Output kind: FRAMEWORK

e: java.lang.IllegalStateException: No file for com.github.jetbrains.rssreader/Foo|4071909078632269291[0] (@ com.github.jetbrains.rssreader/Foo|4071909078632269291[0]) in module `<RssReader:shared>`[ModuleDescriptorImpl@57d43629]
	at org.jetbrains.kotlin.backend.common.serialization.BasicIrModuleDeserializer.deserializeIrSymbol(BasicIrModuleDeserializer.kt:95)
	at org.jetbrains.kotlin.backend.common.serialization.IrModuleDeserializer.declareIrSymbol(IrModuleDeserializer.kt:74)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.findDeserializedDeclarationForSymbol(KotlinIrLinker.kt:127)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.deserializeOrResolveDeclaration(KotlinIrLinker.kt:169)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.getDeclaration(KotlinIrLinker.kt:158)
	at org.jetbrains.kotlin.ir.util.ExternalDependenciesGeneratorKt.getDeclaration(ExternalDependenciesGenerator.kt:57)
	at org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator.generateUnboundSymbolsAsDependencies(ExternalDependenciesGenerator.kt:44)
	at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateUnboundSymbolsAsDependencies(ModuleGenerator.kt:52)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:92)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment$default(Psi2IrTranslator.kt:75)
	at org.jetbrains.kotlin.backend.konan.PsiToIrKt.psiToIr(PsiToIr.kt:187)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:120)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:118)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:94)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:43)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:40)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:94)

Moving Composable function under a class/interface, gives a bit different error:

// shared/src/commonMain
interface Example {
  @Composable
  fun Foo() {
  }
}

Error:

e: java.lang.AssertionError: Unbound symbols not allowed

Unbound public symbol IrSimpleFunctionPublicSymbolImpl: com.github.jetbrains.rssreader/Example.Foo|4071909078632269291[0]
	at org.jetbrains.kotlin.ir.util.SymbolTableKt.noUnboundLeft(SymbolTable.kt:1141)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:96)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment$default(Psi2IrTranslator.kt:75)
	at org.jetbrains.kotlin.backend.konan.PsiToIrKt.psiToIr(PsiToIr.kt:187)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:120)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:118)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:94)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

1reaction
kevincianfarinicommented, Nov 30, 2022

I’m also getting this issue, which was also fixed by marking my composable internal!

1reaction
gregriggins36commented, Nov 14, 2022

I’m getting the exact same issue. Just adding @Composable is bringing this error

I fixed my issue by making the @Composable function internal 🤦‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compose Runtime - Android Developers
Fundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target.
Read more >
Android Studio Arctic Fox | 2020.3.1 Canary 15 |Compose ...
The deployment fails when I try to add kotlinCompilerExtensionVersion '1.0.0-beta06' to the gradle and the error message is "Could not resolve ...
Read more >
Multiplatform Compose and Gradle module metadata abuse
The mechanism by which Kotlin multiplatform artifacts resolve the correct dependency is through Gradle's module metadata format. Gradle Module ...
Read more >
Pending Composition always causing crash when opening ...
Basically this is a common issue in compose , which we are facing . Somehow on recomposition instead of throwing an actual error...
Read more >
Common Language Runtime (CLR) overview - .NET
Code that you develop with a language compiler that targets the runtime is called managed code. Managed code benefits from features such as ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found