Hello from Seoul!

with updated build.gradle.kts works but not with folder.

for example, /src/main/kotlin/example/Example01.kt
I got this message

$ ./gradlew run -Papplication=example.Example01        


e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during psi2ir
File being compiled: /Users/icq4ever/openRNDR/src/main/kotlin/example/Example01.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.bind(IrPublicSymbolBase.kt:58)
        at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
        at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:235)
        at org.jetbrains.kotlin.psi2ir.generators.DeclarationGenerator.generateMemberDeclaration(DeclarationGenerator.kt:78)
        at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateSingleFile(ModuleGenerator.kt:67)
        at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateModuleFragment(ModuleGenerator.kt:47)
        at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:78)
        at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:146)
        at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$default(JvmIrCodegenFactory.kt:64)
        at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:59)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:331)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:123)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:58)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:170)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
        at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:434)
        at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:120)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:357)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:299)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:159)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:80)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:622)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:100)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1713)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: IrSimpleFunctionPublicSymbolImpl for /main|4973935383742426313[0] is already bound: FUN name:main visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl>
        at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.bind(IrPublicSymbolBase.kt:58)
        at org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl.<init>(IrFunctionImpl.kt:99)
        at org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl.createFunction(IrFactoryImpl.kt:125)
        at org.jetbrains.kotlin.ir.declarations.IrFactory$DefaultImpls.createFunction$default(IrFactory.kt:91)
        at org.jetbrains.kotlin.ir.util.OverridesKt$declareSimpleFunctionWithOverrides$1.invoke(overrides.kt:25)
        at org.jetbrains.kotlin.ir.util.OverridesKt$declareSimpleFunctionWithOverrides$1.invoke(overrides.kt:23)
        at org.jetbrains.kotlin.ir.util.SymbolTable.declareSimpleFunction(SymbolTable.kt:1920)
        at org.jetbrains.kotlin.ir.util.OverridesKt.declareSimpleFunctionWithOverrides(overrides.kt:23)
        at org.jetbrains.kotlin.psi2ir.generators.FunctionGenerator.declareSimpleFunctionInner(FunctionGenerator.kt:92)
        at org.jetbrains.kotlin.psi2ir.generators.FunctionGenerator.access$declareSimpleFunctionInner(FunctionGenerator.kt:39)
        at org.jetbrains.kotlin.psi2ir.generators.FunctionGenerator.generateFunctionDeclaration(FunctionGenerator.kt:398)
        at org.jetbrains.kotlin.psi2ir.generators.FunctionGenerator.generateFunctionDeclaration$default(FunctionGenerator.kt:44)
        at org.jetbrains.kotlin.psi2ir.generators.DeclarationGenerator.generateMemberDeclaration(DeclarationGenerator.kt:49)
        ... 41 more


FAILURE: Build failed with an exception.
...

Does the first line of Example01.kt look like

package example

? For me it works.

cd src/main/kotlin
mkdir example
cp  TemplateProgram.kt example/Example01.kt
vi example/Example01.kt
# make first line equal to `package example`, change color to GREEN
cd ../../../
./gradlew run -Papplication=example.Example01

How does Example01.kt look like?

hmm? just change the color GREEN and others are totally same.

import kotlin.math.cos
import kotlin.math.sin
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.loadFont
import org.openrndr.draw.loadImage
import org.openrndr.draw.tint

fun main() = application {
    configure {
        width = 768
        height = 576
    }

    program {
        val image = loadImage("data/images/pm5544.png")
        val font = loadFont("data/fonts/default.otf", 64.0)

        extend {
            drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(0.2))
            drawer.image(image)

            drawer.fill = ColorRGBa.GREEN
            drawer.circle(
                    cos(seconds) * width / 2.0 + width / 2.0,
                    sin(0.5 * seconds) * height / 2.0 + height / 2.0,
                    140.0
            )

            drawer.fontMap = font
            drawer.fill = ColorRGBa.WHITE
            drawer.text("EX01", width / 2.0, height / 2.0)
        }
    }
}

I have no idea, what I missing ? :confused:

You are missing the first line: package example :slight_smile:

If the file was opened in Idea it would suggest you to fix that automatically.
If the folder was example/bla then you would need package example.bla .

1 Like

oh- I see. now it works!! :smiley:
need to understand how kotlin/java works behind.
thank you so much!

1 Like

btw I upload vscode tasks.json to repo.
still need to update how to run subfolder codes, build excutable binary. etc.

When you are comfortable with your setup it would be amazing if you could write a short post Using OPENRNDR with vscode (and you can edit the post any time if you want to improve it :slight_smile: ). Probably some users would like that :slight_smile:

Great work! Thanks for sharing that repo!

sure :slight_smile: let me organizing properly.