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

Unable to link downstream project consuming Kotlin/Native-built runtime #2342

Closed
JakeWharton opened this issue Sep 26, 2022 · 22 comments
Closed
Assignees
Labels
ios runtime Compose runtime problem

Comments

@JakeWharton
Copy link

> Task :molecule-runtime:linkDebugTestIosSimulatorArm64 FAILED
e: Compilation failed: Failed to compute the detailed error message. See the root cause exception.

Shortly: The required symbol androidx.compose.runtime/remember|-4100818973694024771[0] is missing in the module or module dependencies. This could happen if the required dependency is missing in the project. Or if there is a dependency that has a different version (without the required symbol) in the project than the version (with the required symbol) that the module was initially compiled with.

I have kotlin.native.cacheKind=none set in the project's gradle.properties but it still does not compile.

Repro on this branch https://github.com/cashapp/molecule/tree/jw/link-thing/2022-09-21 running ./gradlew -p molecule :m-r:check.

@dima-avdeev-jb
Copy link
Contributor

I will research

@dima-avdeev-jb
Copy link
Contributor

I reproduced this problem with iosSimulatorArm64Test task. I will continue try to fix it.

But also, for now, you may use only jvm tests: ./gradlew -p molecule :m-r:jvmTest

@DjakaTechnology
Copy link

I can reproduce this, also happens when building to an iOS app target not just testing only. I can't use compose runtime in shared module because of this.

@dima-avdeev-jb
Copy link
Contributor

I can reproduce this, also happens when building to an iOS app target not just testing only. I can't use compose runtime in shared module because of this.

Thanks! I will research your sample

@eymar
Copy link
Member

eymar commented Oct 27, 2022

Just noticed the same error in another project. In my case the compose compiler was not applied for k/native targets.
In molecule runtime I see no compose gradle plugin applied (it applies the compiler plugin). Does compose plugin get applied for other targets in molecule runtime (and where is it configured)?

UPD: beside applying the compiler plugin, ComposeGradlePlugin also adds compiler options for k/js - https://github.com/JetBrains/compose-jb/blob/3996233b032772a5afb8ceceafc4affae793e480/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerKotlinSupportPlugin.kt#L67

So I guess, k/js is probably not working too in molecule:runtime?

cc: @JakeWharton

@JakeWharton
Copy link
Author

You are correct we are not specifying the JS option correctly. Molecule's multiplatform entrance is a little more rash than Redwood where we did things a bit more carefully. That being said, we cannot use your Compose plugin because it assumes things about the JS target (the presence of a web extension) that doesn't work in the general case.

In Redwood we have a proper subproject plugin which applies the Compose compiler plugin and configures the JS build correctly: https://github.com/cashapp/redwood/blob/3956a7883950951f38e5d0c442d63b32cdfc955f/build-support/src/main/kotlin/app/cash/redwood/buildsupport/ComposePlugin.kt. I will do the same in Molecule here shortly.

@JakeWharton
Copy link
Author

This issue has resolved itself, but I'm not quite sure why. I upgraded to Kotlin 1.7.20 and JB Compose 1.2.1 (and compiler 1.3.2.1) along with adding the cacheKind=none option and it started to succeed. We also had other build changes such as removing the use of includeBuild across multiplatform projects which is known to not work well, but that shouldn't have affected the behavior.

(Separately I fixed our Gradle plugin to use JS decoys for downstream projects as well as using JS decoys for our own build. Thanks!)

Going to preemptively close and hope it's not an issue in the future!

@JakeWharton JakeWharton closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2022
@saket
Copy link

saket commented Nov 13, 2022

I was also able to fix this specific issue by upgrading to Kotlin 1.7.20, but ended up running into another wall:

e: Compilation failed: Unbound symbols not allowed

Unbound public symbol IrSimpleFunctionPublicSymbolImpl: me.saket.teleport.ui/Presenter.present|-8951064700938915987[0]

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

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

@JakeWharton Do you still have your jw/link-thing/2022-09-21 branch around? I'd like to compare my setup with yours.

@hfhbd
Copy link
Contributor

hfhbd commented Nov 13, 2022

@saket Did you add kotlin.native.cacheKind=none? I got the same error and this resolved it.

@saket
Copy link

saket commented Nov 13, 2022

Yea I already had kotlin.native.cacheKind=none in my gradle.properties so I believe I'm running into something else. Do you have a public project that I can take a look at?

@hfhbd
Copy link
Contributor

hfhbd commented Nov 13, 2022

I have a work-in-progress pr to include molecule into my playground app: https://github.com/hfhbd/ComposeTodo/pull/665/files

I had to add the molecule runtime manually though because I also use the compose plugin: cashapp/molecule#134

@dima-avdeev-jb
Copy link
Contributor

dima-avdeev-jb commented Nov 13, 2022

@saket Can you please try version 1.3.0-alpha01-dev849
with kotlin.native.cacheKind=none

@saket
Copy link

saket commented Nov 14, 2022

Sure, where are your alpha builds hosted on? I couldn't find any information in your readme or releases page.

@saket
Copy link

saket commented Nov 14, 2022

@hfhbd going through this, thank you!

@saket
Copy link

saket commented Nov 14, 2022

Thanks! I'm seeing the same error with 1.3.0-alpha01-dev849.

@mateuy-dev
Copy link

@saket I had the same error in my case when using molecule. Its was caused due that composable functions couldn't be public in native (at least this is what I've read). I fixed it changing them to internal (an in my case only expose the flow created by the molecule launch)

@dima-avdeev-jb
Copy link
Contributor

@saket
Yeah, for now Composable functions for native can be only internal or private. We will fix it in the future.

@Nailik
Copy link

Nailik commented May 12, 2023

@saket Yeah, for now Composable functions for native can be only internal or private. We will fix it in the future.

Did this change or is this still valid?

@eymar
Copy link
Member

eymar commented May 12, 2023

@Nailik

for now Composable functions for native can be only internal or private. We will fix it in the future.

This part is fixed when using kotlin 1.8.20 and compose 1.4.0


kotlin.native.cacheKind=none - this parameter is still needed. The investigation has started by k/native team

@Nailik
Copy link

Nailik commented May 12, 2023

@Nailik

for now Composable functions for native can be only internal or private. We will fix it in the future.

This part is fixed when using kotlin 1.8.20 and compose 1.4.0

kotlin.native.cacheKind=none - this parameter is still needed. The investigation has started by k/native team

Unfortunately i still get error: Module "Rhasspy_Mobile:ui" has a reference to symbol androidx.compose.runtime/CompositionLocalProvider|1991010962478225151[0]. Neither the module itself nor its dependencies contain such declaration. with this project https://github.com/Nailik/rhasspy_mobile/tree/1454949c0d42b60ce48dc57ffb446e4061531522

Edit:
This issue was caused because i forgot to add id("org.jetbrains.compose") in the plugins section

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ios runtime Compose runtime problem
Projects
None yet
Development

No branches or pull requests

10 participants