touchlab / Stately

Kotlin Multiplatform State Library
https://touchlab.co
Apache License 2.0
607 stars 28 forks source link

(x86_64) could not find object file symbol for symbol _kfun:co.touchlab.stately.isolate.RunResult#<init>(){} #79

Open raymondctc opened 2 years ago

raymondctc commented 2 years ago

Hi devs, we saw many of these warnings for this library when building to iOS simulators. We saw similar warnings on other libraries too (e.g. AAkira/Napier when we are on older version 2.4.0) but most of them are gone after upgrading to latest version, would you please advise what we can do about it? Thanks!

Kotlin version: 1.6.20 Stately verison: 1.2.2

image
kpgalligan commented 2 years ago

Closed by accident...

kpgalligan commented 2 years ago

Honestly, no idea right now. It would be helpful to get way more info about your config. How are you adding dependencies, what's your sourceset config (from gradle.properties)

kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.commonizerLogLevel=info

It'll be difficult to research without some kind of repro, so if this is public, that would help, but I assume not.

I am seeing that warning as something that periodically comes up in the Kotlin slack. I don't think there's anything specific to Stately, although I won't rule anything out arbitrarily.

It also might be interesting to know what your framework config is. Static? Dynamic? How are you integrating it?

ubuntudroid commented 1 year ago

For me, this started to happen the moment I made the shared module static. And it doesn't just happen for stately, but for nearly all libraries. In fact, there are about 36k warnings for our little project - too many for Xcode to handle sending it into periods of a spinning wheel of death.

It doesn't seem to matter whether the libraries are direct or transitive dependencies.

Relevant gradle.properties settings:

kotlin.mpp.enableCInteropCommonization=true
findjigar commented 1 year ago

Closing as this is most probably stale now. Also most likely resolved with newer Kotlin version like how https://github.com/touchlab/Stately/issues/90 got resolved

ubuntudroid commented 1 year ago

@findjigar this isn't stale at all unfortunately. And it's not fixed by upgrading to Kotlin 1.8. In fact, what fixed the issue in #90 was most likely the switch from static to dynamic. Switching back to dynamic also fixes things here, but isn't an option in many cases.

For me, what "fixed" this was adding the following to the shared module (and just removing the line while debugging the shared module as it makes it impossible to read variable and field values):

kotlin {
  ...
  cocoapods {
    ...
    xcodeConfigurationToNativeBuildType["Debug"] =
            org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE
  }
}

This works, but also isn't optimal for obvious reasons.

findjigar commented 1 year ago

@ubuntudroid ok thanks. I wasn't aware that there is an issue pending here. I'm re-opening this issue

findjigar commented 1 year ago

@ubuntudroid Would you be able to provide a minimal sample app that produces this issue, so we have a good repro for it?

ubuntudroid commented 11 months ago

Sorry for the late reply, this somehow slipped through the cracks. Unfortunately I wasn't able to create a minimal sample app. It seems to be something very specific in how the project was setup. I'm not working on that project anymore and don't have access to the source, so I cannot look it up unfortunately.

I'll report back when I stumble on that issue again in another project.