hi there :wave: i’m playing around kotlin-native ...
# kotlin-native
i
hi there 👋 i’m playing around kotlin-native compilation for a kts (script), but getting weird exceptions from kotlinc-native so far:
Copy code
# docker run --rm -it --volume $(pwd):/tool --workdir="/tool" --entrypoint sh adoptopenjdk/openjdk11

# get the kotlin-native cli pack
apt-get update && apt-get install wget 
wget <https://github.com/JetBrains/kotlin/releases/download/v1.6.10/kotlin-native-linux-x86_64-1.6.10.tar.gz> && \
tar -xvzf kotlin-native-*.tar.gz && \
rm *.tar.gz && \
mv kotlin-native-* kotlin-native

# test.main.kts only has one line:
# println("Hello from script!")

# compile with kotlinc-native
kotlin-native/bin/kotlinc-native -script test.main.kts -o test
results:
Copy code
* Source files: test.main.kts
 * Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10
 * Output kind: PROGRAM

exception: org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration Test_main
File being compiled: (1,1) in /tool/test.main.kts
The root cause org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException was thrown at: org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:18)

...
Caused by: org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration SCRIPT
it should be possible to compile script to native, right? Thanks in advance for any feedback!
e
as far as I know, scripting is only implemented for JVM
👍 2