Open fmagin opened 1 year ago
There also seems to be a problem compiling scripts:
INFO Compiling sourceFile: /home/fmagin/gits/ghidra-jupyter-kotlin/GhidraJupyterKotlin/ghidra_scripts/HelloWorldScriptKt.kt (KotlinScriptProvider)
ERROR Cannot access 'java.lang.Object' which is a supertype of 'HelloWorldScriptKt'. Check your module classpath for missing or conflicting dependencies (KotlinCompilerMessageCollector)
ERROR Type mismatch: inferred type is KClass<kotlin.Exception /* = java.lang.Exception */> but KClass<out Throwable> was expected (KotlinCompilerMessageCollector)
ERROR Cannot access 'java.lang.Object' which is a supertype of 'ghidra.program.flatapi.FlatProgramAPI'. Check your module classpath for missing or conflicting dependencies (KotlinCompilerMessageCollector)
ERROR Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class ghidra.program.flatapi.FlatProgramAPI, unresolved supertypes: java.lang.Object
Adding -Xextended-compiler-checks argument might provide additional information.
(KotlinCompilerMessageCollector)
ERROR REPORT SCRIPT ERROR: /home/fmagin/gits/ghidra-jupyter-kotlin//GhidraJupyterKotlin/ghidra_scripts/HelloWorldScriptKt.kt : Back-end (JVM) Internal error: Failed to generate function run
File being compiled: (25,5) in /home/fmagin/gits/ghidra-jupyter-kotlin/GhidraJupyterKotlin/ghidra_scripts/HelloWorldScriptKt.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124) (HeadlessAnalyzer) org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function run
File being compiled: (25,5) in /home/fmagin/gits/ghidra-jupyter-kotlin/GhidraJupyterKotlin/ghidra_scripts/HelloWorldScriptKt.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124)
at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:206)
at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:170)
at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:88)
at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:305)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:289)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:116)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:156)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:143)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.invokeLowerings(CodegenFactory.kt:122)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.runLowerings(KotlinToJVMBytecodeCompiler.kt:331)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.kt:198)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileBunchOfSources(KotlinToJVMBytecodeCompiler.kt:139)
at ghidra.app.script.KotlinScriptProvider.doEmbeddedCompile(KotlinScriptProvider.java:240)
at ghidra.app.script.KotlinScriptProvider.compile(KotlinScriptProvider.java:201)
at ghidra.app.script.KotlinScriptProvider.getScriptInstance(KotlinScriptProvider.java:86)
at ghidra.app.util.headless.HeadlessAnalyzer.runScriptsList(HeadlessAnalyzer.java:898)
at ghidra.app.util.headless.HeadlessAnalyzer.processWithImport(HeadlessAnalyzer.java:1738)
at ghidra.app.util.headless.HeadlessAnalyzer.processLocal(HeadlessAnalyzer.java:448)
at ghidra.app.util.headless.AnalyzeHeadless.launch(AnalyzeHeadless.java:127)
at ghidra.GhidraLauncher.launch(GhidraLauncher.java:77)
at ghidra.Ghidra.main(Ghidra.java:54)
Caused by: java.lang.IllegalStateException: Error type encountered: [Error type: Unable to substitute type (<Error class: unknown class>)] (ErrorType).
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124)
at org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt.mapType(descriptorBasedTypeSignatureMapping.kt:83)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:276)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapClass(KotlinTypeMapper.kt:230)
at org.jetbrains.kotlin.codegen.FunctionCodegen.lambda$getThrownExceptions$3(FunctionCodegen.java:1099)
at kotlin.collections.CollectionsKt___CollectionsKt.map(_Collections.kt:3787)
at org.jetbrains.kotlin.codegen.FunctionCodegen.getThrownExceptions(FunctionCodegen.java:1097)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:215)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:166)
at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:137)
at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:200)
... 22 more
The new Ghidra 11.2 Version now requires JDK 21, but Kotlin 1.6 which is used for the kernel in this plugin doesn't support JDK 21. This means this issue now blocks the Ghidra plugin release for 11.2
That's really unfortunate... We can open some issues in their bug-tracker, but I don't know how much of a priority it's going to be...
Kotlin 1.6 is long deprecated, so they probably don't care.
The Kotlin Kernel project is currently built on Kotlin 1.9.23, but Kotlin 2.0 is already out.
So we can either upgrade to the newer Kotlin Kernel for Kotlin 1.9.23, and then upgrade to 2.0 later, or sit it out a bit without Ghidra 11.2 support and then upgrade to a future version of the Kotlin Kernel for 2.0 directly.
Since I'm not currently using that, and barring anyone requesting an upgrade, I'm good with waiting... Do you know if the current kernel supports the new JDK?
Do you know if the current kernel supports the new JDK?
yes, Kernel Version 0.12.0-313
should support JDK 21 because it's for Kotlin 1.9.23, but my attempts of upgrading the Ghidra plugin failed with weird version mismatches nonetheless, and I couldn't figure out why
We last updated over a year ago and are still on the kernel version
0.11.0-89-1
with Kotlin 1.6. The current kernel version0.12.0-14
supports Kotlin 1.8.20, and is probably nice to upgrade to.The kernel is now also regularly published to Maven without requiring JetBrain internal dev dependencies, so upgrading is now a lot easier and doesn't require asking the maintainer for a new manual release.
The current blocker for upgrading is that
InterruptKernelAction
andShutdownKernelAction
don't compile anymore, because they import various specific things from the underlying kernel, and those locations seem to have changed