Upgrade to Kotlin 1.3.71 failed

macOS 10.15.4 (Catalina)

I was trying to bump Kotlin version 1.3.61 --> 1.3.71 in this project Lets-Plot.

I was able to successfully build python extension package but unfortunately it fails at run-time with the following error:

/opt/anaconda3/envs/dev-py37/lib/python3.7/site-packages/lets_plot/_kbridge.py in <module>
      5 from typing import Dict
----> 7 import lets_plot_kotlin_bridge
      9 from ._type_utils import standardize_dict

ImportError: dlopen(/opt/anaconda3/envs/dev-py37/lib/python3.7/site-packages/lets_plot_kotlin_bridge.cpython-37m-darwin.so, 2): Symbol not found: _GSS_C_NT_ANONYMOUS
  Referenced from: /opt/anaconda3/envs/dev-py37/lib/python3.7/site-packages/lets_plot_kotlin_bridge.cpython-37m-darwin.so
  Expected in: flat namespace
 in /opt/anaconda3/envs/dev-py37/lib/python3.7/site-packages/lets_plot_kotlin_bridge.cpython-37m-darwin.so

What could cause the Symbol not found error?

Other couple things that I noticed:

  • IDEA (2019.3.4) shows errors:

    Incompatible Kotlin/Native libraries
    There are 133 libraries attached to the project that were compiled with a newer Kotlin/Native compiler and can’t be read in IDE:
    “stdlib” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/common/stdlib
    “AVFoundation” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/AVFoundation
    “AVKit” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/AVKit
    “Accelerate” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/Accelerate
    “Accounts” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/Accounts
    “AdSupport” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/AdSupport
    “AddressBook” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/AddressBook
    “AppKit” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/AppKit
    “ApplicationServices” at /Users/Igor/.konan/kotlin-native-macos-1.3.71/klib/platform/macos_x64/Ap…

  • Heap memory demand raised so that that I got OutOfMemoryError when running :python-extension:compileKotlinNative task and had to bump size of Gradle build VM heap to get it finished.

Hello, @alshan!
It seems like you got all possible issues with the 1.3.7* release, that’s unfortunate.
First of all, about the error. The root cause here was the compiler cache - new feature enabled for the debug mode. It was aiming to reduce compilation time by caching Kotlin/Native’s platform libraries. But for some reason, in this particular case, it added a lot of unneeded and unresolvable references to your result library.
I managed to workaround this problem by disabling caches. To do it, just add this line (kotlin.native.cacheKind=none) to your gradle.properties file. Then everything worked fine, at least in my local build.
Now a bit on two suspicious things you found. The first, IDEA warning, is a result of Kotlin/Native library standard(.klib) is not stable yet, and no backward compatibility is provided. As soon as the IDE plugin updates to the next Kotlin version, it becomes blind on them. The same is true in another direction - when you have new libraries in the project, but the IDE plugin is still 1.3.61, none of the libraries will be readable at all.
Another issue is a result of a new feature added with 1.3.70 release - Gradle daemon use. It is also aiming to speed up compilation, especially when the compiler is warmed-up, but has a side-effect of additional memory consumption. If this is a problem in your case, it can also be disabled by setting this kotlin.native.disableCompilerDaemon=true in your gradle.properties.
Also, just for the record: what’s the reason you use debug compilation in this project?

1 Like

Thank you for investigating our issues! Setting kotlin.native.cacheKind=none does fix the situation with unresolved references.

debug mode helped by providing a stack trace on couple occasions when Jupyter core was crushing because of issues in our python extension. Therefore we prefer to include debug info for now.