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

Undefined symbols for _kfun:platform.darwin.objcKniBridge77$darwin(kotlin.native.internal.NativePtr;kotlin.native.internal.NativePtr)platform.darwin.NSObject? #626

Closed
yuriry opened this issue Oct 5, 2018 · 9 comments
Assignees
Labels
ux User Experience issue

Comments

@yuriry
Copy link

yuriry commented Oct 5, 2018

I'm following client-mpp sample in my MPP project, which generates an Android AAR and iOS framework. The version information is as follows:

buildscript {
    ext.kotlin_version = '1.3.0-rc-57'
    ext.kotlin_native_version = '0.9.2'
    ext.serialization_version = '0.8.1-rc13'
    ext.ktor_version = "0.9.5-rc13"
    ext.android_gradle_version = '3.2.0'
}

ktor is my second dependency after serialization. Serialization works without problems on both iOS and Android. After adding dependency on ktor, I got IosClientEngine-related error when building iOS framework (Android AAR is generated without problems).

> Task :ios:compileDebugIos_x64KotlinNative
Undefined symbols for architecture x86_64:
  "_kfun:platform.darwin.objcKniBridge77$darwin(kotlin.native.internal.NativePtr;kotlin.native.internal.NativePtr)platform.darwin.NSObject?", referenced from:
      _kfun:io.ktor.client.engine.ios.IosClientEngine.object-1.<init>#internal in combined.o
ld: symbol(s) not found for architecture x86_64
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

> Task :ios:compileDebugIos_x64KotlinNative FAILED

What should I do to resolve it?

Thank you in advance!

@Alex009
Copy link

Alex009 commented Oct 6, 2018

same problem. i fix it when set this versions:

ext {
    kotlin_version = '1.3.0-rc-57'
    kotlin_native_version = '0.9.2'
    coroutines_version = '0.26.1-rc-conf2'
    serialization_version = '0.8.1-rc13'
    ktor_version = '0.9.5-rc13-conf2'
}

but in runtime coroutines fail with

kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread

on

#2	0x0000000106f8324a in ThrowIncorrectDereferenceException at /opt/teamcity-agent/work/4d622a065c544371/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:75
#3	0x0000000106f9ee9a in CheckIsMainThread ()
#4	0x0000000106fd7c0f in kfun:kotlinx.coroutines.<get-EMPTY_ACTIVE>#internal at /Users/qwwdfsad/workspace/kotlinx.coroutines2/common/kotlinx-coroutines-core-common/src/JobSupport.kt:1050
#5	0x0000000106fe7507 in kfun:kotlinx.coroutines.JobSupport.<init>(kotlin.Boolean)kotlinx.coroutines.JobSupport at /Users/qwwdfsad/workspace/kotlinx.coroutines2/common/kotlinx-coroutines-core-common/src/JobSupport.kt:84
#6	0x0000000106ff0608 in kfun:kotlinx.coroutines.CompletableDeferredImpl.<init>#internal at /Users/qwwdfsad/workspace/kotlinx.coroutines2/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt:62
#7	0x0000000106ff056a in kfun:kotlinx.coroutines.CompletableDeferred(kotlinx.coroutines.Job?)Generic at /Users/qwwdfsad/workspace/kotlinx.coroutines2/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt:43
#8	0x0000000106ff26d0 in kfun:kotlinx.coroutines.CompletableDeferred$default(kotlinx.coroutines.Job?;kotlin.Int)Generic at /Users/qwwdfsad/workspace/kotlinx.coroutines2/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt:38

@yuriry
Copy link
Author

yuriry commented Oct 6, 2018

@Alex009 This runtime issue looks similar to what I had earlier in the serialization library.

@Alex009
Copy link

Alex009 commented Oct 6, 2018

@yuriry yes, reason same - library (coroutines) not updated to new kotlin/native concurency scheme

@yuriry
Copy link
Author

yuriry commented Oct 6, 2018

@Alex009 May be it is worth creating a separate issue in coroutines project?

@e5l e5l self-assigned this Oct 6, 2018
@e5l e5l added bug ux User Experience issue and removed bug labels Oct 6, 2018
@e5l
Copy link
Member

e5l commented Oct 6, 2018

Hy, @yuriry, @Alex009. Thanks for the report.
Unfortunately, the kotlin native versions is not backward compatible for now.

@yuriry
Copy link
Author

yuriry commented Oct 6, 2018

@e5l Could you please give more details on what not backward compatible means? Backward incompatible with ktor, coroutines or something else? Should we use this guide or is it incorrect?
Thank you in advance!

@e5l
Copy link
Member

e5l commented Oct 10, 2018

When using native, we should stick to the same compiler and library versions.
You could find ktor versions in gradle.properties file:

# kotlin
kotlin_version=1.3.0-rc-131
kotlin_native_version=1.3.0-rc-131
# kotlin libraries
kotlinx_io_version=0.1.0-alpha-17-rc13
serialization_version=0.8.2-rc13
coroutines_version=0.30.2-eap13
atomic_fu_version=0.11.10-eap13

@Alex009
Copy link

Alex009 commented Oct 10, 2018

@e5l on this versions compilation success, thx. now on ios bug #634 :( but this issue resolved

@e5l e5l closed this as completed Oct 10, 2018
@yuriry
Copy link
Author

yuriry commented Oct 10, 2018

I whish I could migrate to kotlin_version=1.3.0-rc-131 and serialization_version=0.8.2-rc13 but I can't because of this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User Experience issue
Projects
None yet
Development

No branches or pull requests

3 participants