Hi, everyone. I am interested in kotlin/native com...
# compiler
k
Hi, everyone. I am interested in kotlin/native compiler(typically LLVM Backend) and its optimization, so I have been analyzing line by line of Kotlin open source to know Kotlin/Native Compiler Pipeline first (not on the abstract level). By the way, I'm struggling to find the solution to debug Kotlin/native compiler (for tracking the runtime function calls in the compiler like LLDB for executable files) when it takes source file and compilation config as input. It was my first idea to clone & build kotlin project(github: jetbrains/kotlin), to start gradle task
./gradlew :kotlin-native:dist
and run
lldb ./dist/bin/konanc
, but it didn't work with the error below.
Copy code
* What went wrong:
Cannot locate tasks that match ':kotlin-native:build' as project 'kotlin-native' not found in root project 'kotlin'.
a
hi, the Kotlin/Native parts are disabled by default - did you enable it? You need to create a
local.properties
file in the root project directory. Inside it, set
kotlin.native.enabled=true
https://github.com/JetBrains/kotlin/tree/master/kotlin-native#building-from-source
👀 1
k
Thank you @Adam S. After enabling it, that gradle task was successfully finished. But, another error: When running
lldb kotlin-native/dist/bin/konanc
,
kotlin-native/dist/bin/konanc is not a valid executable
occurs in my terminal.
and do you have another option for tracking the function call in
/kotlin-native
?
a
Not sure what exactly you are trying to do. The K/N compiler itself is a JVM application, so if you want to introspect it, you should use JVM tools
✅ 1
k
Like YourkitJavaProfiler, right?